vitest-dev / vitest-dev/vitest
Tests are duplicated after hitting "u" in watch mode to update snapshots
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Describe the bug
In longer running tests with snapshots, I'm finding that watch mode duplicates the tests when snapshots are being updated. The tests themselves are not run more than once, but the view of the tests is itself duplicated. This happens regardless of the tests being concurrent or not.
Reproduction
Here's a github repo: https://github.com/jakebailey/vitest-watch-mode-bug
I've performed the steps listed in the readme in the below screencast:
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (20) x64 Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
Memory: 42.11 GB / 47.05 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 20.11.0 - /run/user/1000/fnm_multishells/2583630_1705436394438/bin/node
Yarn: 1.22.21 - /run/user/1000/fnm_multishells/2583630_1705436394438/bin/yarn
npm: 10.3.0 - /run/user/1000/fnm_multishells/2583630_1705436394438/bin/npm
pnpm: 8.14.1 - /run/user/1000/fnm_multishells/2583630_1705436394438/bin/pnpm
bun: 1.0.22 - ~/.local/bin/bun
npmPackages:
vitest: ^1.2.0 => 1.2.0
Used 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked jakebailey/vitest-watch-mode-bug reproduction and follow its README to reproduce the snapshot update flow in watch mode. Press "u" during a longer-running snapshot test and verify that the test view is displayed only once afterward, for both concurrent and non-concurrent tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100