Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshots failing since 3.0.5 #7430

Closed
6 tasks done
ronaldcurtis opened this issue Feb 5, 2025 · 5 comments
Closed
6 tasks done

Snapshots failing since 3.0.5 #7430

ronaldcurtis opened this issue Feb 5, 2025 · 5 comments

Comments

@ronaldcurtis
Copy link

Describe the bug

After upgrading to 3.0.5 of vitest, all snapshot tests now fail with the following:

The snapshot state for '/path/to/test/foobar.test.tsx' is not found. Did you call 'SnapshotClient.setup()'?

Reproduction

Create a simple snapshot test:

import { describe, expect, it } from 'vitest'

describe('Snapshot example', () => {
  it('renders as expected', () => {
    expect('foo').toMatchSnapshot()
  })
})

System Info

System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 69.92 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.13.0 - ~/.asdf/installs/nodejs/22.13.0/bin/node
    npm: 10.9.2 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 10.1.0 - ~/.asdf/installs/nodejs/22.13.0/bin/pnpm
  Browsers:
    Chrome: 132.0.6834.160
    Edge: 132.0.2957.140
    Safari: 17.6
  npmPackages:
    @vitejs/plugin-react-swc: 3.7.2 => 3.7.2 
    @vitest/coverage-v8: 3.0.5 => 3.0.5 
    vite: 6.0.11 => 6.0.11 
    vitest: 3.0.5 => 3.0.5

Used Package Manager

npm

Validations

@hi-ogawa
Copy link
Contributor

hi-ogawa commented Feb 5, 2025

We got a similar report on discord https://discord.com/channels/917386801235247114/1333757743386984529/1333757743386984529, but I couldn't repro https://stackblitz.com/edit/vitest-dev-vitest-uekoaeam?file=test%2Frepro.test.ts We'll need more details to investigate this further 🙏

Copy link

github-actions bot commented Feb 5, 2025

Hello @ronaldcurtis. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@ronaldcurtis
Copy link
Author

I was able to fix the error, it seems to be connected to monorepos (we're using pnpm v10 workspaces). After upgrading all our packages to 3.0.5, the error seems to go away. I'll try and reproduce on stackblitz

@hi-ogawa
Copy link
Contributor

hi-ogawa commented Feb 5, 2025

Right. I was guessing that monorepo with multiple Vitest versions can lead to this cryptic error. We may be able to improve error message, but the reproduction would be still needed. It doesn't have to be on stackblitz and github repo to clone is also welcome.

@erictaylor
Copy link

Just wanted to note here that I'm running into the same issue after upgrading a project via a Dependabot update from 3.0.4 to 3.0.5. My project is also a monorepo with PNPM v10.

We additionally had some weird issues where i18next stopped working but only in prod builds (after the commit to bump vitest from Dependabot).

We ended up reverting the commit from Dependabot to upgrade vitest to 3.0.5.

I'm not clear on what was causing the underlying test failures with the "Did you call 'SnapshotClient.setup()'?" error, but in case of our other dependencies seeming to have issues after, I suspect that an underlying terser version bump that was included as part of the commit changes to pnpm-lock.yml were the cause.

Note the [email protected] to [email protected] change

I would provide a reproduction if I could, but the codebase we ran into this issue on is currently private.

Maybe some of this additional context could be helpful to those who come across this issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants