-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to clean up unused snapshots? #29
Comments
You could probably call |
@suchipi tried the approach you suggested but ran into couple of problems.
To solve it I created a Another problem is that Also after keeping the state inside separate handler the Which means that the only way to update snapshots is to use And the last issue comes back to I hope my explanation is understandable. If needed I can create a PR with my current changes. |
This issue could probably be solved with a beforeAll hook so that we create a SnapshotState for every file. The other issues sound like they would need changes in jest-snapshot though. I think they'd be okay with making removeUncheckedKeys callable when we're not in update mode, but the matchSnapshot(true) thing is kinda A PR would be welcome but it will be a while before I have some time to look at it. |
I'd like to:
It seems that there is no way to accomplish it with this tool. Is there perhaps some other companion tool to help with that?
Alternatively, could such a support be added to
chai-jest-snapshot
? I could help out with implementation...I noticed that the imported
SnapshotState
class hasremoveUncheckedKeys()
method, which seems to be doing exactly what is needed. But I guess one can't just call it from thematchSnapshot()
function inbuildMatchSnapshot.js
, as then it would remove all the snapshots besides the current one that's tested.The text was updated successfully, but these errors were encountered: