vitest
SKILL.md
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.
Requirements: Vite >=v6.0.0, Node >=v20.0.0
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 via
node:child_process(default) ornode:worker_threads - Built-in coverage via V8 (default) or Istanbul
- Snapshot testing, mocking, and spy utilities via Tinyspy
- Browser mode for real browser component testing
- Benchmarking via Tinybench
- In-source testing
- Type testing via expect-type
- Sharding for CI parallelism
Based on Vitest 4.x (v4.0.17). Key v4 changes:
workspacereplaced withprojects, pool options are top-level, V8 coverage uses AST-based analysis,coverage.allremoved,basicreporter removed.
Core
| Topic | Description | Reference |
|---|---|---|
| Configuration | Vitest and Vite config integration, defineConfig, mergeConfig | core-config |
| CLI | Command line interface, commands and all options | core-cli |
| Test API | test/it function, modifiers like skip, only, concurrent, for/each | core-test-api |
| Describe API | describe/suite for grouping tests and nested suites | core-describe |
| Expect API | Assertions with toBe, toEqual, matchers, asymmetric matchers, soft/poll | core-expect |
| Hooks | beforeEach, afterEach, beforeAll, afterAll, aroundEach, aroundAll | core-hooks |
Features
| Topic | Description | Reference |
|---|---|---|
| Mocking | Mock functions, modules, timers, dates, globals with vi utilities | features-mocking |
| Snapshots | Snapshot testing with file, inline, and file snapshots | features-snapshots |
| Coverage | Code coverage with V8 or Istanbul providers, thresholds, CI | features-coverage |
| Test Context | Test fixtures, context.expect, test.extend, scoped fixtures | features-context |
| Concurrency | Concurrent tests, parallel execution, sharding, CI setup | features-concurrency |
| Filtering | Filter tests by name, file patterns, tags, changed files | features-filtering |
Advanced
| Topic | Description | Reference |
|---|---|---|
| Vi Utilities | vi helper: mock, spyOn, fake timers, hoisted, waitFor, mockObject | advanced-vi |
| Environments | Test environments: node, jsdom, happy-dom, edge-runtime, custom | advanced-environments |
| Type Testing | Type-level testing with expectTypeOf and assertType | advanced-type-testing |
| Projects | Multi-project workspaces, different configs per project | advanced-projects |
| Browser Mode | Real browser testing with Playwright, WebdriverIO, or Preview | advanced-browser |
| Migration | Migrating from Jest and upgrading from Vitest 3.x to 4.x | advanced-migration |
| Benchmarking | Performance benchmarking with Tinybench integration | advanced-benchmarking |
| In-Source Testing | Writing tests alongside production code | advanced-in-source |
| Reporters | Built-in reporters and custom reporter configuration | advanced-reporters |
| Debugging | VS Code, IntelliJ, Chrome DevTools, inspect flags | advanced-debugging |
| Vitest UI | Interactive browser UI with module graph and coverage | advanced-ui |
| Common Errors | Frequent errors and their solutions | advanced-common-errors |
Weekly Installs
1
Repository
zackbart/skillsFirst Seen
7 days ago
Security Audits
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1