You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
no-large-snapshots counts the length of the snapshot based on the whole CallExpression from expect to the end. Therefore it includes the expect side in the limit, where the limit is described in the documentation (and at least I expected) as the limit of the snapshot itself.
e.g.
expect(
functionUnderTest(
arg1,
arg2,
arg3
)
).toMatchInlineSnapshot(`
a
b
c`)
With a max size of 5, this should be fine - the snapshot is 4 lines long, including the initial empty line.
However, the rule measures from expect so gets 10 lines, so would fail.
IMO the rule should only measure the length of the actual snapshot template literal. I don't think this is technically a breaking change as no code which passed previously could fail now.
The text was updated successfully, but these errors were encountered:
G-Rath
changed the title
no-large-snapshots incorrectly counts lines for inline snapshots
[no-large-snapshots] no-large-snapshots incorrectly counts lines for inline snapshots
Oct 28, 2021
G-Rath
changed the title
[no-large-snapshots] no-large-snapshots incorrectly counts lines for inline snapshots
[no-large-snapshots] line count incorrect for inline snapshots
Oct 28, 2021
no-large-snapshots
counts the length of the snapshot based on the wholeCallExpression
fromexpect
to the end. Therefore it includes theexpect
side in the limit, where the limit is described in the documentation (and at least I expected) as the limit of the snapshot itself.e.g.
With a max size of 5, this should be fine - the snapshot is 4 lines long, including the initial empty line.
However, the rule measures from
expect
so gets 10 lines, so would fail.IMO the rule should only measure the length of the actual snapshot template literal. I don't think this is technically a breaking change as no code which passed previously could fail now.
The text was updated successfully, but these errors were encountered: