vitest
vitest copied to clipboard
Interactive snapshot update/create mode
Clear and concise description of the problem
We are testing media assets, by matching their md5 basically. So we have a suit, that basically calls the same render function but in different contexts (projects, parameters). Basically, the output must be validated before confirming, that this md5 should be a snapshot. Jest has an interactive mode, but async describe is not a thing anymore, so we tried to switch to Vitest.
Suggested solution
- Maybe do not create snapshots by default (I know, that env CI=1 solves it)
- Have interactive update/create mode, that does 1 test at a time and asks to validate output
Alternative
I could implement it myself but have no way to interrupt runner and it just times out. Also, libraries such as enquirer
do not work during the run.
Additional context
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
I could implement it myself but have no way to interrupt runner and it just times out. Also, libraries such as enquirer do not work during the run.
I think we can just run all the tests, and if there are snapshot mismatches, instead of an error we can generate new ones and show it in the terminal, like jest does, so user can confirm its content. After the change is confirmed, we mark it as resolved.
Yes, basically interrupt the runner until the action in the console is resolved (confirm or not the snapshot).
I just thought, would be cool, if snapshotMatch
method would return if a snapshot is updated. We create media and would like to store confirmed in the cloud so we can also compare them later visually in case of a snapshot (which basically md5) mismatch.