Skip to content

The @nx/vitest plugin provides various generators to help you create and configure vitest projects within your Nx workspace. Below is a complete reference for all available generators and their options.

configuration

Generate a Vitest setup for a project.

Usage:

Terminal window
nx generate @nx/vitest:configuration [options]

Options

OptionTypeDescriptionDefault
projectstring [required]The name of the project to test.
compilerstringThe compiler to use"babel"
coverageProviderstringCoverage provider to use."v8"
inSourceTestsbooleanDo not generate separate spec files and set up in-source testing.false
runtimeTsconfigFileNamestringThe 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.
skipFormatbooleanSkip formatting files.false
skipViteConfigbooleanSkip generating a vite config file.false
testEnvironmentstringThe vitest environment to use. See https://vitest.dev/config/#environment.
testTargetstringThe test target of the project to be transformed to use the @nx/vitest:test executor.
uiFrameworkstringUI framework to use with vitest.
## Getting Help
You can get help for any generator by adding the `--help` flag:
```bash
nx generate @nx/vitest:<generator> --help
```