-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Allow to exclude test files with cli #4148
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersp2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)pr welcome
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersp2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)pr welcome
Clear and concise description of the problem
I have the following use case for an exclude flag in the vitest cli:
We have a codebase with some unit tests using vitest in
./src/Alongside this code base there are some integration tests sharing the dto interfaces from
./src/. The integration tests are in./tests/api/and use their own vitest config in./tests/api/vitest.config.ts.We use
lint-stagedto execute relevant tests withvite relatedlike the docs suggest.However - those integration tests should not run in our commit hook due to their fragile nature. So I'd like to pass an exclude flag like so
vitest related --exclude './tests/api/**'.I couldn't find a solution with the already available CLI options.
-twill only work on test names, but I want to exlude files.Suggested solution
Introduce an
--excludethat'll exclude all tests matching a regex pattern in this CLI run. It'll override any exclude/include pattern from the vitest config files.Alternative
No response
Additional context
No response
Validations