Open askoufis opened 1 year ago
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 snapshot