tech-vitest

Installation
SKILL.md

Vitest Testing Framework

Fast, Vite-powered testing framework with Jest-compatible API and native ESM. Vitest excels at:

  • Watch mode — Instant feedback during development with smart file watching
  • Native TypeScript/JSX — Compiled by Vite, no extra setup
  • Mocking ecosystemvi.mock() for modules, MSW v2 for HTTP requests, fake timers for time-dependent code
  • Snapshot testing — Auto-managed snapshots with inline snapshot support
  • Concurrent tests — Parallel test execution with proper isolation

Core challenge: test isolation. Vitest's hoisting rules for vi.mock() require vi.hoisted() for shared mock state. MSW v2 changes handler APIs. Snapshot updates must be intentional.

Workflow

When setting up tests or adding test cases:

  1. Identify scope — What behavior? (unit/integration/e2e?)
  2. Determine dependencies — HTTP? Timers? Other modules?
  3. Choose strategyvi.mock() with hoisting for modules, MSW for HTTP, fake timers for time
  4. Hoist shared state — Use vi.hoisted() if mocks need variables from test scope
Related skills
Installs
34
GitHub Stars
15
First Seen
Feb 14, 2026