Deprecated: from WebStorm 2022.3 Beta, Vitest support by default. Please refer https://blog.jetbrains.com/webstorm/2022/11/webstorm-2022-3-beta/#Vitest_support
A simple WebStorm plugin to run Vitest tests.
.vitest-result.json
file "scripts": {
"test": "vitest --watch",
"webstorm-integration": "vitest --watch --reporter=dot --reporter=json --outputFile=.vitest-result.json",
},
.vitest-result.json
filePlease install Awesome Console for code link/navigation from console.
workspaces
declared in package.json
, and working directory is package's directory.package.json
for Vitest tested file, and working directory may be project's root directory or subdirectory of subproject.Attention: for mono repository with subprojects independent, working directory will be subproject's directory,
and Vitest Runner will use vite.config.js
inside subproject.
--coverage
support? Please add c8
dependency in package.json and reopen the project.{
"devDependencies": {
"c8": "^7.12.0"
}
}
This plugin just a temp solution before official Vitest support from WebStorm. I think JetBrains people will do this job, and they know Vitest is great framework. For Vitest support in WebStorm, please vote here: https://youtrack.jetbrains.com/issue/WEB-54437
Please enable globals: true
for test
in Vitest configuration file.
// vite.config.ts
import {defineConfig} from 'vitest/config'
export default defineConfig({
test: {
globals: true,
},
})
Exclude jest: jest is removed from the devDependencies, anyway, jest still resolved and installed by co dependency during npm install
.
You can use following solution to exclude jest:
"scripts": {
"postinstall": "rm -rf node_modules/jest*; rm -rf node_modules/@jest"
}
Attention: Please reload(close/open) project if you enable globals: true
first time.
Using IDE built-in plugin system: https://plugins.jetbrains.com/plugin/19220-vitest-runner
Settings/Preferences > Plugins > Marketplace > Search for "vitest" > Install Plugin
Manually:
Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...