You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Obsolete snapshots are snapshots that were created by a test that no longer exists/had its name changed. These snapshots are not detected when running jest. This doesn't matter that much when running jest normally, they'll be removed the next time you update snapshots. However, when running on CI, it's often desirable to fail CI if there are obsolete snapshots. This is the behaviour that jest --ci does.
I believe these are referred to as unchecked snapshots within the jest source code. These are tracked in the snapshotState, so potentially adding them to the commonSnapshotState could fix the issue. I tried to do this but was unsuccessful.
Reproduction
Create a file with 2 specific snapshots that write to the same file
Run jest to create the snapshots
Delete one of the snapshot tests
Run jest --ci
jest --ci should fail as there is an obsolete snapshot, but it passes and doesn't show any messaging about the obsolete snapshot
The text was updated successfully, but these errors were encountered:
Yeah, that's actually a known issue.. I wander why I didn't mention it in the readme 🤔 . The way it was worked-around in Storybook is to create an integrity test that will check abandoned files. you can take a look here https://github.com/storybookjs/storybook/blob/next/code/addons/storyshots-core/src/api/integrityTestTemplate.ts (this code was already changed many times from the last time I'have seen, so not sure what's going on there now =) )
I will try to find some time to test your direction. can't have an ETA though
Obsolete snapshots are snapshots that were created by a test that no longer exists/had its name changed. These snapshots are not detected when running
jest
. This doesn't matter that much when running jest normally, they'll be removed the next time you update snapshots. However, when running on CI, it's often desirable to fail CI if there are obsolete snapshots. This is the behaviour thatjest --ci
does.I believe these are referred to as
unchecked
snapshots within the jest source code. These are tracked in thesnapshotState
, so potentially adding them to thecommonSnapshotState
could fix the issue. I tried to do this but was unsuccessful.Reproduction
jest
to create the snapshotsjest --ci
jest --ci
should fail as there is an obsolete snapshot, but it passes and doesn't show any messaging about the obsolete snapshotThe text was updated successfully, but these errors were encountered: