Vitest extension for Visual Studio Code. Available on Visual Studio Marketplace.
- Run, debug, and watch Vitest tests in Visual Studio Code.
- NX support (see the NX sample).
- An
@open
tag can be used when filtering tests, to only show the tests open in the editor.
- Visual Studio Code version >= 1.77.0.
- Vitest version >= v1.4.0
You can identify if your config is loaded by the extension with process.env.VITEST_VSCODE
and change the configuration accordingly.
vitest.packagePath
: The path to apackage.json
file of a Vitest executable (it's usually insidenode_modules
) in case the extension cannot find it. It will be used to resolve Vitest API paths. This should be used as a last resort fix. If the extension cannot find Vitest, please open an issue.vitest.nodeExecutable
: This extension spawns another process and will use this value asexecPath
argument.vitest.nodeEnv
: Environment passed to the runner process in addition toprocess.env
vitest.debugExclude
: Excludes files matching specified glob patterns from debugging. Default:[\"<node_internals>/**\", \"**/node_modules/**\"]
See https://vitest.dev/guide/workspace.html for monorepo support.
You can use VS Code command add folder to workspace
to add the sub directory. The extension should work fine.
The extension looks for Vitest config or Vitest workspace config to establish the connection with Vitest. If you have several config files, it's recommended to combine them in a single Vitest workspace for a better CPU performance (only have a single Vitest instance instead of several).