What problem does it solve?
Vitest 4 expertise prevents flaky, hard-to-debug test suites by guiding you through correct configuration, mocking, snapshots, browser mode, coverage, and v3→v4 breaking changes.
Core Features & Use Cases
- Vitest 4 configuration: set up
vitest.config.ts (environment, globals, setupFiles, discovery, timeouts) and use v4 pool syntax (pool + poolOptions).
- Mocking done safely: use
vi.mock, vi.fn, vi.spyOn, hoisting rules, vi.importActual, and typed helpers like vi.mocked.
- Snapshots + coverage that actually match: handle snapshot v2 differences, update snapshots correctly, and choose coverage providers (
v8 vs istanbul) with thresholds.
- Multi-environment testing: use the
projects API (monorepos and browser-vs-node scenarios) and avoid the obsolete workspace key.
Example: You upgraded to Vitest 4 and your monorepo tests start failing due to pool config changes, workspace being ignored, and spy state behaving differently; this skill routes you to the exact reference sections and migration steps to fix configuration and test isolation quickly.
Quick Start
Ask: "Configure Vitest 4 for a Vite project with jsdom, globals disabled, setupFiles, correct pool settings, and enable coverage with thresholds."