vitest-dev / vitest-dev/vitest

cli filtering in watch mode when `p` is pressed early

Open
#3,889 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

p2-edge-case
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Describe the bug

When running vitest in watch mode, filtering is not possible. It first runs all tests (which can take several minutes) before filtering works.

Expected behaviour

When pressing p to filter, test runs stop and it it possible to filter. This is how it works in jest.

Actual behaviour

When pressing p to filter while tests are running, tests do not stop and one needs to wait until all tests finished before it is possible to filter

Reproduction

https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/

System Info
System:
    OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 2.46 GB / 7.65 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 20.3.1 - ~/.nvm/versions/node/v20.3.1/bin/node
    Yarn: 3.5.1 - ~/.nvm/versions/node/v20.3.1/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v20.3.1/bin/npm
    pnpm: 8.6.9 - ~/.nvm/versions/node/v20.3.1/bin/pnpm
  Browsers:
    Chrome: 115.0.5790.110
Used Package Manager

npm

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 StackBlitz basic example and reproduce the behavior in Vitest watch mode by pressing p while tests are running. Trace the watch-mode filtering entry point and make the behavior match the expected result: the current test run stops and filtering becomes available immediately.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.