vitest-js
Installation
SKILL.md
Vitest
Use these conventions for testing JavaScript/TypeScript projects with vitest-dev/vitest.
Source Baseline
- Prefer official docs at
vitest.devand the matching GitHub release over older Jest-era snippets. - Current stable baseline checked for this skill: Vitest
4.1.11(August 2026). Vitest5.0.0-rc.2exists but is not the stablelatesttag. - Vitest 4.1.11 supports Vite
^6.0.0 || ^7.0.0 || ^8.0.0and Node.js^20.0.0 || ^22.0.0 || >=24.0.0. - Treat
mainbranch README/package metadata as prerelease when it disagrees withlatest; use npmdist-tags.latestplus the versioned docs for stable support floors. - Vitest 4.1.11 tightens mocker redirect handling to the filesystem allowlist; do not rely on redirect-based mocks outside the configured allowlist.
- Vitest is Vite-native: it reuses the project's Vite config, transforms, and resolvers — do not bolt Babel on top unless a transform is missing.
- Vitest's
viAPI is Jest-compatible enough that mostjest.*calls map 1:1 tovi.*, but the runtime, ESM handling, and mocking semantics differ — do not assume Jest behavior.
Install
pnpm add -D vitest