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 ecosystem —
vi.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:
- Identify scope — What behavior? (unit/integration/e2e?)
- Determine dependencies — HTTP? Timers? Other modules?
- Choose strategy —
vi.mock()with hoisting for modules, MSW for HTTP, fake timers for time - Hoist shared state — Use
vi.hoisted()if mocks need variables from test scope
Related skills
More from ravnhq/ai-toolkit
core-coding-standards
Universal code quality rules — KISS, DRY, clean code, code review. Base
81promptify
Transform user requests into detailed, precise prompts for AI models.
66lang-typescript
TypeScript language patterns and type safety rules — strict mode, no
53tech-react
React 19 patterns for components, hooks, Server Components, and data
52design-frontend
Visual design system patterns for web UIs. Tailwind CSS v4 design tokens
43platform-backend
Server-side architecture and security — API design, error handling, validation,
39