vitest

$npx skills add antfu/skills --skill vitest
SKILL.md

Vitest

Vitest is a next-generation testing framework powered by Vite. It provides a Jest-compatible API with native ESM, TypeScript, and JSX support out of the box. Vitest shares the same config, transformers, resolvers, and plugins with your Vite app. **Key Features:** - Vite-native: Uses Vite's transformation pipeline for fast HMR-like test updates

Vitest is a next-generation testing framework powered by Vite. It provides a Jest-compatible API with native ESM, TypeScript, and JSX support out of the box. Vitest shares the same config, transformers, resolvers, and plugins with your Vite app.
Key Features:
  • Vite-native: Uses Vite's transformation pipeline for fast HMR-like test updates
  • Jest-compatible: Drop-in replacement for most Jest test suites
  • Smart watch mode: Only reruns affected tests based on module graph
  • Native ESM, TypeScript, JSX support without configuration
  • Multi-threaded workers for parallel test execution
  • Built-in coverage via V8 or Istanbul
  • Snapshot testing, mocking, and spy utilities
The skill is based on Vitest 3.x, generated at 2026-01-28.

Core

Topic
Description
Reference
Configuration
Vitest and Vite config integration, defineConfig usage
CLI
Command line interface, commands and options
Test API
test/it function, modifiers like skip, only, concurrent
Describe API
describe/suite for grouping tests and nested suites
Expect API
Assertions with toBe, toEqual, matchers and asymmetric matchers
Hooks
beforeEach, afterEach, beforeAll, afterAll, aroundEach

Features

Topic
Description
Reference
Mocking
Mock functions, modules, timers, dates with vi utilities
Snapshots
Snapshot testing with toMatchSnapshot and inline snapshots
Coverage
Code coverage with V8 or Istanbul providers
Test Context
Test fixtures, context.expect, test.extend for custom fixtures
Concurrency
Concurrent tests, parallel execution, sharding
Filtering
Filter tests by name, file patterns, tags

Advanced

Topic
Description
Reference
Vi Utilities
vi helper: mock, spyOn, fake timers, hoisted, waitFor
Environments
Test environments: node, jsdom, happy-dom, custom
Type Testing
Type-level testing with expectTypeOf and assertType
Projects
Multi-project workspaces, different configs per project