Skip to content

Commit

Permalink
test(no-large-snapshots): workaround instanceof issue in ESLint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Mar 29, 2024
1 parent 8dabd75 commit 05bae05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/rules/__tests__/no-large-snapshots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,15 @@ ruleTester.run('no-large-snapshots', rule, {
messageId: 'tooLongSnapshots',
data: { lineLimit: 50, lineCount: 58 },
},
// todo: "instanceof" doesn't work with ESLint v9
...(usingFlatConfig()
? [
{
messageId: 'tooLongSnapshots' as const,
data: { lineLimit: 50, lineCount: 58 },
},
]
: []),
],
},
{
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-large-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const reportOnViolation = (
const snapshotName = getAccessorValue(node.expression.left.property);

isAllowed = allowedSnapshotsInFile.some(name => {
/* istanbul ignore next */
if (name instanceof RegExp) {
return name.test(snapshotName);
}
Expand Down

0 comments on commit 05bae05

Please sign in to comment.