-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
testFileDir
always matches
#4425
Comments
Start a new pull request in StackBlitz Codeflow. |
Yes, the filter is just |
if you see the repro, the filter contains the |
@sheremet-va did you see the comment above? The defect appears valid to me. |
You are correct, this is a bug. It probably happens because of this check ( vitest/packages/vitest/src/node/workspace.ts Line 255 in 7dee832
To fix this, we should append |
I challenge to contribute. |
Describe the bug
Given the tree:
Vitest will match
tests1
&tests11
when supplied with filtertests1/
.Whilst i recognise that you can use the
include
option or even specifying direct filenames, that is a very heavyhanded and hardcoded approach which doesn't fit large test repositories (in my case i have 400+ test files in nested directories).Instead it would be less-surprising for it to match based on inputs such as
tests1/
to only use that directory. A regex\b
would also be acceptable.Reproduction
Using this StackBlitz you can execute the following scripts that illustrates a plausible scenario:
pnpm test:all
: ✅pnpm test:1
: ❌ - Runs tests for bothfolder1
andfolder11
pnpm test:2
: ✅pnpm test:11
: ✅Important
In reality, most scenarios wouldn't be matching based on numbers, but i've got into weird scenarios where expressions collide with each other:
test_blocks
andtest_blockscope
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: