@nx/vite:vitest

Generate a Vitest setup for a project.

Usage

1nx generate vitest ... 2

By default, Nx will search for vitest in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

1nx g @nx/vite:vitest ... 2

Show what will be generated without writing to disk:

1nx g vitest ... --dry-run 2

Options

project

Required
string

The name of the project to test.

coverageProvider

string
Default: v8
Accepted values: v8, istanbul, custom

Coverage provider to use.

compiler

string
Default: babel
Accepted values: babel, swc

The compiler to use

inSourceTests

boolean
Default: false

Do not generate separate spec files and set up in-source testing.

runtimeTsconfigFileName

string

The name of the project's tsconfig file that includes the runtime source files. If not provided, it will default to tsconfig.lib.json for libraries and tsconfig.app.json for applications.

skipViteConfig

boolean
Default: false

Skip generating a vite config file.

testTarget

Hidden
string

The test target of the project to be transformed to use the @nx/vite:test executor.

testEnvironment

string
Accepted values: node, jsdom, happy-dom, edge-runtime

The vitest environment to use. See https://vitest.dev/config/#environment.

uiFramework

string
Accepted values: angular, react, none

UI framework to use with vitest.

skipFormat

Internal
boolean
Default: false

Skip formatting files.