Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(no-large-snapshots): actually compare allowed name strings to name (
  • Loading branch information
G-Rath committed 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
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
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.