@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.
Monorepo World: October 7, 2024Monorepo World: October 7, 2024Join 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}
161nx test my-app
2To 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}
19And 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
2The path to the local vitest config
Mode for Vite.
Directory to write coverage report to.
No description available.
Watch files for changes and rerun tests related to changed files.