vitest icon indicating copy to clipboard operation
vitest copied to clipboard

fix(snapshot)!: fail test with obsolete snapshot on CI

Open hi-ogawa opened this issue 6 months ago • 1 comments

Description

  • Closes https://github.com/vitest-dev/vitest/issues/7954

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:

  • [x] It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • [ ] Ideally, include a test that fails without this PR but passes with it.
  • [ ] Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • [ ] Run the tests with pnpm test:ci.

Documentation

  • [ ] If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • [x] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

hi-ogawa avatar May 12 '25 08:05 hi-ogawa

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
Latest commit ec1c009fee58536754333f3546b5b6a5addbf69e
Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6823d874a3bc87000785d21e
Deploy Preview https://deploy-preview-7963--vitest-dev.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar May 12 '25 09:05 netlify[bot]

We also need to add this to migration guide

sheremet-va avatar Jun 22 '25 08:06 sheremet-va