Skip to content

fix: --project negation excludes browser instances#10131

Merged
sheremet-va merged 2 commits into
vitest-dev:mainfrom
felamaslen:fix/project-negation-browser-instances
Apr 14, 2026
Merged

fix: --project negation excludes browser instances#10131
sheremet-va merged 2 commits into
vitest-dev:mainfrom
felamaslen:fix/project-negation-browser-instances

Conversation

@felamaslen

Copy link
Copy Markdown
Contributor

Description

--project='!name' did not exclude browser project instances because they have derived names like name (chromium). The instance-level filtering would re-check each derived name against the negation regex, which didn't match, so the instances passed through.

When the original project name is explicitly excluded by a negation filter, all its browser instances are now excluded without falling through to per-instance filtering.

Fixes #10130

Reproduction

https://github.com/felamaslen/vitest-project-exclude-repro

Changes

  • core.ts: Added isExcludedByProjectFilter() which checks if a name is explicitly matched by a negation pattern (e.g. --project='!name')
  • resolveProjects.ts: When the original project name is excluded by negation, return empty instances instead of falling through to per-instance filtering

`--project='!name'` did not exclude browser project instances because
they have derived names like "name (chromium)". The instance-level
filtering would re-check each derived name against the negation regex,
which didn't match, so the instances passed through.

When the original project name is explicitly excluded by a negation
filter, all its browser instances are now excluded without falling
through to per-instance filtering.

Fixes vitest-dev#10130
@netlify

netlify Bot commented Apr 12, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 052af7a
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/69dc116efeed7c00089333cf
😎 Deploy Preview https://deploy-preview-10131--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@AriPerkkio AriPerkkio linked an issue Apr 13, 2026 that may be closed by this pull request
6 tasks

@sheremet-va sheremet-va left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs tests. See test/cli/browser-configs for examples

Comment thread packages/vitest/src/node/core.ts
Comment thread packages/vitest/src/node/projects/resolveProjects.ts Outdated
@felamaslen

Copy link
Copy Markdown
Contributor Author

Thanks for feedback - addressed

@felamaslen felamaslen requested a review from sheremet-va April 13, 2026 11:02
@sheremet-va sheremet-va requested a review from AriPerkkio April 13, 2026 16:42
@sheremet-va sheremet-va merged commit 9423dc0 into vitest-dev:main Apr 14, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--project='!name' doesn't exclude browser project instances Negated project filtering (!) broken on browser projects

3 participants