Snapper
Snapper copied to clipboard
Error when old snapshots are left behind
Currently when a test which has a snapshot is deleted, Snapper ignores the created snapshot on the disk.
It's a manual process to determine whether there are any redundant snapshot files left on the disk.
It would be nice if Snapper was somehow able to tell you there are redundant snapshot files and potentially error when this is happening during a CI build.
Idea for NUnit with update snapshots:
- on startup find all snapshots
- on test track used snapshots
- on shutdown compare and delete old snapshots
I think this should be easy to implement as an extension
Alternative we can told the user to add a global startup and teardown hook for snapper
@ViceIce I was thinking about implementing recently and realised that if I wanted to do something like what you suggested above, it would be super difficult.
Idea for NUnit with update snapshots:
- on startup find all snapshots
- on test track used snapshots
- on shutdown compare and delete old snapshots
I think this should be easy to implement as an extension
For the above idea to work the test run would have to be running all the tests. What should happen if the user provides a filter and only runs one test? Is there a way to find out if the user is running the full test suite?
The only solution I can think of is that I either need to go deep into the implementations of Xunit and Nunit and replicate the logic to determine all possible tests so that I can determine which snapshots should exist or not.
Ok, that looks really framework dependent. 🤔 May be we can simply delete all snapshots if update is active? But for that, we need a possibillity to detect partial test runs too.
At least in nunit this should be possible. I don't know xunit very much.