Skip to content

Commit

Permalink
fix(no-large-snapshots): avoid instanceof RegExp check for ESLint v…
Browse files Browse the repository at this point in the history
…9 compatibility (#1542)
  • Loading branch information
G-Rath authored Mar 29, 2024
1 parent 295120e commit af4a9c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rules/no-large-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ const reportOnViolation = (
const snapshotName = getAccessorValue(node.expression.left.property);

isAllowed = allowedSnapshotsInFile.some(name => {
if (name instanceof RegExp) {
return name.test(snapshotName);
if (typeof name === 'string') {
return snapshotName === name;
}

return snapshotName === name;
return name.test(snapshotName);
});
}
}
Expand Down

0 comments on commit af4a9c9

Please sign in to comment.