test
nx test my-appRuns vitest run for the project. The target is inferred only when vitest is in the package.json of the project or of the workspace root, and it is cached.
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
testPathPattern |
string | none | Runs only the test files that match. |
watch |
boolean | false |
Keeps running and tests again after every change. |
coverage |
boolean | false |
Collects coverage. Needs a Vitest coverage package. |
ci |
boolean | false |
Runs once even when watch is set. |
root |
string | none | Project directory. Nx knows it, so you rarely set this. |
config |
string | none | Path of the Vitest config file. |
reporter |
string | none | Vitest reporter, such as default, verbose or json. |
run |
boolean | none | Deprecated, has no effect. Running once is the default. |
verbose |
boolean | false |
Uses the verbose reporter, unless reporter is set. |
additionalArgs |
array | none | More command-line arguments for Vitest. |
Example
Section titled “Example”nx test my-app --testPathPattern=src/utils --coverage