fix(snapshot)!: fail test with obsolete snapshot on CI#7963
Merged
sheremet-va merged 7 commits intovitest-dev:mainfrom Jun 22, 2025
Merged
fix(snapshot)!: fail test with obsolete snapshot on CI#7963sheremet-va merged 7 commits intovitest-dev:mainfrom
sheremet-va merged 7 commits intovitest-dev:mainfrom
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
sheremet-va
requested changes
May 13, 2025
| this.workerState.config.snapshotOptions.updateSnapshot === 'none' | ||
| && result.unchecked | ||
| ) { | ||
| const error = new Error(`Obsolete snapshots found: ${result.uncheckedKeys.join(', ')}`) |
Member
There was a problem hiding this comment.
I wonder if we can print it in a better way (should we? obsolete snapshots are already printed one line at a time, but without the separation by test file)
Contributor
Author
There was a problem hiding this comment.
I tweaked the error message. Please check the example in the PR description. It's mostly a copy of the base reporter.
sheremet-va
previously approved these changes
Jun 9, 2025
sheremet-va
approved these changes
Jun 22, 2025
Member
|
We also need to add this to migration guide |
1 task
This was referenced Nov 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
example
$ CI=1 TEST_OBSOLETE=1 pnpm -C test/snapshots test:fixtures --root test/fixture s/obsolete ... RUN v3.2.0-beta.1 /home/hiroshi/code/others/vitest/test/snapshots/test/fixtures/obsolete ✓ src/test2.test.ts (2 tests) 2ms ❯ src/test1.test.ts (3 tests) 2ms ✓ foo 1ms ✓ fuu 0ms ✓ bar 1ms ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ FAIL src/test1.test.ts [ src/test1.test.ts ] Error: Obsolete snapshots found when no snapshot update is expected. · foo 1 · fuu 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ Snapshots 2 obsolete ↳ src/test1.test.ts · foo 1 · fuu 1 Test Files 1 failed | 1 passed (2) Tests 5 passed (5) Start at 09:00:48 Duration 205ms (transform 29ms, setup 0ms, collect 29ms, tests 4ms, environment 0ms, prepare 94ms) ELIFECYCLE Command failed with exit code 1.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.