Skip to content

Commit

Permalink
fix(snapshot): fix obsolete toMatchSnapshot("...") of skipped tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 24, 2024
1 parent b700d26 commit e9a61c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/snapshot/src/port/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ export default class SnapshotState {

markSnapshotsAsCheckedForTest(testName: string): void {
this._uncheckedKeys.forEach((uncheckedKey) => {
if (keyToTestName(uncheckedKey) === testName) {
// skip snapshots with following keys
// testName n
// testName > xxx n (this is for toMatchSnapshot("xxx") API)
if (/ \d+$| > /.test(uncheckedKey.slice(testName.length))) {
this._uncheckedKeys.delete(uncheckedKey)
}
})
Expand Down

0 comments on commit e9a61c3

Please sign in to comment.