Skip to content

Negated project filtering (!) broken on browser projects #9977

@james-camilleri

Description

@james-camilleri

Describe the bug

When running vitest against a config with multiple vitest projects, filtering out browser projects (with the negation/! operator) does not work. The expected behaviour and current behaviour over various filtering scenarios is laid out in the following table:

filter expected # of tests actual # of tests result
none 2 2 🟢
--project node 1 1 🟢
--project browser 1 1 🟢
--project !node 1 1 🟢
--project !browser 1 2 🔴

These are the above results executed on the attached reproduction:

Image

Reproduction

https://github.com/james-camilleri/vitest-project-filtering-reproduction

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (16) x64 AMD Ryzen AI 7 PRO 350 w/ Radeon 860M
    Memory: 3.13 GB / 23.65 GB
  Binaries:
    Node: 24.14.1 - C:\Users\JamesCamilleri\scoop\apps\nodejs-lts\current\node.EXE
    Yarn: 1.22.22 - C:\Users\JamesCamilleri\scoop\apps\nodejs-lts\current\bin\yarn.CMD
    npm: 11.11.0 - C:\Users\JamesCamilleri\scoop\apps\nodejs-lts\current\npm.CMD
    pnpm: 10.33.0 - C:\Users\JamesCamilleri\scoop\shims\pnpm.EXE
    Deno: 2.7.7 - C:\Users\JamesCamilleri\scoop\shims\deno.EXE
  Browsers:
    Edge: Chromium (145.0.3800.82)
  npmPackages:
    @vitest/browser-playwright: ^4.1.2 => 4.1.2
    vite: ^8.0.1 => 8.0.3
    vitest: ^4.1.2 => 4.1.2

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions