vitest-dev / vitest-dev/vitest
Include an ability to write the actual snapshot to disk (with a debug flag) when there is a snapshot mismatch
@macarie is already working on this.
Since Jun 12, 2026.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Clear and concise description of the problem
So when a snapshot is mismatched the only place where the comparison is presented is in the test output.
And then a rerun is required in order to update the snapshot.
And when there are lot of snapshot tests that have mismatches this can be quite tedious.
Suggested solution
Please include an ability that when there is a mismatch to write the actual snapshot to disk as a file with some suitable debug flag included.
That way devs can compare the actual with expected and conclude whether the difference is significant and then easily update the expected with changes from the new actual.
This tool from java context has this facility and it is very convenient and I miss it with vitest.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.