Skip to content

felamaslen/vitest-project-exclude-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vitest --project='!pattern' negation bug with browser projects

Minimal reproduction showing that --project negation patterns do not exclude browser-based projects.

The vitest docs state:

You can also filter projects using wildcards like --project=packages*, and exclude projects with --project=!pattern.

Setup

npm install
npx playwright install chromium

Reproduction

Positive selection works correctly — only project-a runs:

npx vitest run --project=project-a
# ✓ |project-a| a.test.ts > project-a test
# Test Files  1 passed (1)
# Tests       1 passed (1)

Negation does not exclude the browser project:

npx vitest run '--project=!project-b'
# ✓ |project-a| a.test.ts > project-a test
# ✓ |project-b (chromium)| b.test.ts > project-b test
# Test Files  2 passed (2)
# Tests       2 passed (2)

Expected: 1 test file, 1 test (only project-a).

Actual: 2 test files, 2 tests (both projects run).

Cause

Browser projects create instances with derived names (e.g. project-b (chromium)). The negation regex ^(?!project\-b$) does not match project-b (chromium), so the browser instance passes through the filter.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors