Skip to content

Commit

Permalink
fix(no-large-snapshots): actually compare allowed name strings to name (
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored Jul 26, 2020
1 parent b269e88 commit 622a08c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/rules/__tests__/no-large-snapshots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,27 @@ ruleTester.run('no-large-snapshots', rule, {
},
],
},
{
// "should not report whitelisted large snapshots based on regexp"
filename: '/mock-component.jsx.snap',
code: [
generateExportsSnapshotString(58, 'a big component w/ text'),
generateExportsSnapshotString(58, 'a big component 2'),
].join('\n\n'),
options: [
{
whitelistedSnapshots: {
'/mock-component.jsx.snap': ['a big component 2'],
},
},
],
errors: [
{
messageId: 'tooLongSnapshots',
data: { lineLimit: 50, lineCount: 58 },
},
],
},
],
});

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-large-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const reportOnViolation = (
return name.test(snapshotName);
}

return snapshotName;
return snapshotName === name;
});
}
}
Expand Down

0 comments on commit 622a08c

Please sign in to comment.