Skip to content

Commit

Permalink
fix(no-large-snapshots): don't use instanceof for checking regexps
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Mar 29, 2024
1 parent 0ff9935 commit d77a688
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 d77a688

Please sign in to comment.