project.json:

//... "my-app": { "targets": { //... "test": { "executor": "@nrwl/vite:test", //... //... "options": { "config": "apps/my-app/vite.config.ts" } //... } } }
nx test my-app

Examples

To run testing in watch mode, you can create a new configuration within your test target, and have watch set to true. For example:

"my-app": { "targets": { //... "test": { "executor": "@nrwl/vite:test", //... //... "options": { "config": "apps/my-app/vite.config.ts" }, "configurations": { "watch": { "watch": true } } } } }

And then run nx run my-app:test:watch.

Alternatively, you can just run the default test target with the --watch flag preset, like so:

nx run my-app:test --watch

Options

coverage

boolean
Default: false

Enable coverage report

mode

string
Default: test
Accepted values: test, benchmark, typecheck

The mode that vitest will run on

update

u
boolean
Default: false

Update snapshots

config

string

The path to the local vitest config

passWithNoTests

boolean
Default: true

Pass the test even if no tests are found

reporters

Array<string>

An array of reporters to pass to vitest

reportsDirectory

string

Directory to write coverage report to.

testNamePattern

string

Run tests with full names matching the pattern

watch

boolean
Default: false

Enable watch mode