@nx/vite:test
Test using Vitest.
Options can be configured in project.json
when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.
The State of JS survey is live, featuring a monorepo tools sectionThe State of JS survey is live, featuring a monorepo tools sectionVote for us
Test using Vitest.
Options can be configured in project.json
when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.
project.json
:
1//...
2"my-app": {
3 "targets": {
4 //...
5 "test": {
6 "executor": "@nx/vite:test",
7 //...
8 //...
9 "options": {
10 "config": "apps/my-app/vite.config.ts"
11 }
12 //...
13 }
14 }
15}
16
1nx test my-app
2
To run testing in watch mode, you can create a new configuration within your test target, and have watch set to true. For example:
1"my-app": {
2 "targets": {
3 //...
4 "test": {
5 "executor": "@nx/vite:test",
6 //...
7 //...
8 "options": {
9 "config": "apps/my-app/vite.config.ts"
10 },
11 "configurations": {
12 "watch": {
13 "watch": true
14 }
15 }
16 }
17 }
18}
19
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:
1nx run my-app:test --watch
2
false
Enable coverage report
test
test
, benchmark
, typecheck
The mode that vitest will run on
false
Update snapshots
The path to the local vitest config
true
Pass the test even if no tests are found
An array of reporters to pass to vitest
Directory to write coverage report to.
Run tests with full names matching the pattern
No description available.
false
Enable watch mode