-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow passing --include on the CLI? #4861
Comments
Can't you just pass it down as a filter? The terminal usually handles it before Vitest ever needs to.
Alternatively you can just pass down any substring:
|
Ah, that makes sense. I don't know why I didn't think of that as an implicit |
|
We believe that it's better to use a workspace feature to organize your Vitest configuration: import { defineWorkspace } from 'vitest/config'
export default defineWorkspace([
{
test: {
include: ['tests/**/*.unit.test.ts'],
name: 'unit',
environment: 'happy-dom',
}
},
{
test: {
include: ['tests/**/*.e2e.test.ts'],
name: 'e2e',
environment: 'node',
}
}
]) You can then run it as For that reason, as a team, we decided that it's better to wait until there is more demand for this feature (CLI |
Clear and concise description of the problem
Right now, there's no documented way I could find to specify the
include
config option with the CLI. Would the project be open to adding an--include
CLI option?Suggested solution
Being able to run
vitest --include 'some/globs'
.--exclude
support was added in #4148 -> #4279. I suppose this proposal is roughly the same idea.Alternative
In the meantime, we can
-t
to specify on test names. But it'd be nice to go by file name.Additional context
My use case is a project that has a few end-to-end tests defined with Vitest. Each of those tests runs a lot of commands and modifies the current directory. So being able to run e.g.
pnpm run test:e2e:create
that calls `vitest --includeValidations
The text was updated successfully, but these errors were encountered: