Install Vitest in Vitest
From the Vitest cheat sheet · Setup & Configuration · verified Nov 2026
Install Vitest
Add Vitest to a project, check the version, and wire up npm scripts
bash
# Install (needs Node >= 22.12 and Vite >= 6.4)
npm install -D vitest
npx vitest # watch mode
npx vitest run # run once
npx vitest --version # vitest/5.1.0📌 Vitest 5 needs Node 22.12+ and Vite 6.4+; vite is a peer dependency
⚡ vitest watches locally but runs once in CI or non-TTY shells
🟢 Bun users: run 'bun run test', since 'bun test' starts Bun's runner
💡 The official Vitest VS Code extension runs tests from the gutter
installsetupnpm
Continue with Vitest
Save the full cheat sheet or work through every related task.