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

Project filter is includes shared tests across projects #7131

Open
6 tasks done
unional opened this issue Dec 25, 2024 · 0 comments · May be fixed by #7146
Open
6 tasks done

Project filter is includes shared tests across projects #7131

unional opened this issue Dec 25, 2024 · 0 comments · May be fixed by #7146
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@unional
Copy link

unional commented Dec 25, 2024

Describe the bug

I tried to use workspace on a single package that contains both server side and client side code, as well as code that can run on both environments.
I created one Vitest project config for each platform.

When filtering tests using project filter in watch mode, it run the shared tests on both projects instead of the project that I tried to filter.

src
  client
  server
  shared
vitest.config.browser.ts # run tests in `client` and `shared` folder
vitest.config.node.ts # run tests is `server` and `shared` folder
vitest.workspace.ts

vitest run --project=node is working correctly.
This issue only occurs in watch mode.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-project-filter-issue

press w and enter node to filter the node project.

you will observe |browser| src/shared/some.test.ts is also executed.

System Info

System:
    OS: Linux 5.15 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 25.32 GB / 31.30 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.18.0 - /run/user/1000/fnm_multishells/56615_1735161007494/bin/node
    npm: 10.8.2 - /run/user/1000/fnm_multishells/56615_1735161007494/bin/npm
    pnpm: 9.12.2 - /run/user/1000/fnm_multishells/56615_1735161007494/bin/pnpm
  npmPackages:
    @vitest/coverage-v8: ^2.1.8 => 2.1.8 
    vitest: ^2.1.8 => 2.1.8

Used Package Manager

pnpm

Validations

@hi-ogawa hi-ogawa added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Dec 25, 2024
@DevJoaoLopes DevJoaoLopes linked a pull request Dec 29, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants