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

Open
#8,403 2 comments 0 reactions 1 assignee View on GitHub

@macarie is already working on this.

Since Jun 12, 2026.

p2-nice-to-have
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.