Skip to content

test

Terminal window
nx test my-app

Runs 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.

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.
Terminal window
nx test my-app --testPathPattern=src/utils --coverage
nx-astro 3.2.0 · MIT Developed by