vitest-dev / vitest-dev/vitest

Tests are duplicated after hitting "u" in watch mode to update snapshots

Open
#4,986 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending triage
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:

vitewatchbug

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.