-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
Running vitest run --update within a monorepo that's configured to use a workspace (https://vitest.dev/guide/workspace.html) doesn't update any snapshots.
I've included a link to a minimal reproduction of this issue on StackBlitz below. It's a pnpm monorepo with a single package containing a single failing snapshot test.
Running pnpm run test:run:update yields the following output:
❯ pnpm run test:run:update
> @ test:run:update /home/projects/vitest-dev-vitest-21kers
> vitest run --update
RUN v1.2.2 /home/projects/vitest-dev-vitest-21kers
❯ |test-package| snapshot.test.ts (1)
× snapshot
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL |test-package| snapshot.test.ts > snapshot
Error: Snapshot `snapshot 1` mismatched
- Expected
+ Received
- "original"
+ "updated"
❯ eval snapshot.test.ts:4:21
2|
3| test('snapshot', () => {
4| expect('updated').toMatchSnapshot();
| ^
5| });
6|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Snapshots 1 failed
Test Files 1 failed (1)
Tests 1 failed (1)
Start at 10:34:49
Duration 1.18s (transform 279ms, setup 0ms, collect 282ms, tests 7ms, environment 0ms, prepare 192ms)
ELIFECYCLE Command failed with exit code 1.
Observe that the test fails but the snapshot is not updated, despite using the --update flag.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-21kers?file=package.json
System Info
$ pnpm dlx envinfo --system --npmPackages '{vitest,@vitest/*,vite,@vitejs/*}' --binaries --browsers
Packages: +1
+
Progress: resolved 1, reused 0, downloaded 1, added 1, done
System:
OS: Linux 6.6 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
CPU: (12) arm64 unknown
Memory: 5.87 GB / 7.66 GB
Container: Yes
Shell: 5.2.15 - /bin/bash
Binaries:
Node: 21.6.1 - /usr/local/share/nvm/versions/node/v21.6.1/bin/node
npm: 10.2.4 - /usr/local/share/nvm/versions/node/v21.6.1/bin/npm
pnpm: 8.15.1 - /usr/local/share/nvm/versions/node/v21.6.1/bin/pnpm
npmPackages:
vitest: 1.2.2 => 1.2.2Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)