vitest
Installation
SKILL.md
Vitest Best Practices
For test philosophy (behavior vs implementation, TDD workflow, when to mock), see /testing-philosophy.
Critical Rules
- Node 22+: Use
pool: 'forks'- threads have known issues - CI optimization: Single worker, disable watch, enable
isolate: falseif safe - Coverage: Always define
coverage.include- defaults exclude too much - Mocking: Prefer
vi.spyOnovervi.mock- avoids hoisting footguns - RTL cleanup: Requires
globals: truein config
Memory Safety (MANDATORY)
Vitest in watch mode holds ~2 GB per process. 12 repos = 24+ GB = machine crash.
Related skills