vitest

Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.

Category
Engineering
Skill
198 of 261
Source
Kevin wiki

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 5.x (beta), generated at 2026-06-22.

Core

TopicDescriptionReference
ConfigurationVitest and Vite config integration, defineConfig usagecore-config (references/core-config.md)
CLICommand line interface, commands and optionscore-cli (references/core-cli.md)
Test APItest/it function, modifiers like skip, only, concurrentcore-test-api (references/core-test-api.md)
Describe APIdescribe/suite for grouping tests and nested suitescore-describe (references/core-describe.md)
Expect APIAssertions with toBe, toEqual, matchers and asymmetric matcherscore-expect (references/core-expect.md)
HooksbeforeEach, afterEach, beforeAll, afterAll, aroundEachcore-hooks (references/core-hooks.md)

Features

TopicDescriptionReference
MockingMock functions, modules, timers, dates with vi utilitiesfeatures-mocking (references/features-mocking.md)
SnapshotsSnapshot testing with toMatchSnapshot and inline snapshotsfeatures-snapshots (references/features-snapshots.md)
CoverageCode coverage with V8 or Istanbul providersfeatures-coverage (references/features-coverage.md)
Test ContextTest fixtures, context.expect, test.extend for custom fixturesfeatures-context (references/features-context.md)
ConcurrencyConcurrent tests, parallel execution, shardingfeatures-concurrency (references/features-concurrency.md)
FilteringFilter tests by name, file patterns, tagsfeatures-filtering (references/features-filtering.md)
Test TagsLabel tests with tags to filter runs and apply shared optionsfeatures-test-tags (references/features-test-tags.md)
ReportersBuilt-in reporters, default selection, CI/output configfeatures-reporters (references/features-reporters.md)
BenchmarkingWrite benchmarks with the bench fixture (Tinybench)features-benchmarking (references/features-benchmarking.md)

Advanced

TopicDescriptionReference
Vi Utilitiesvi helper: mock, spyOn, fake timers, hoisted, waitForadvanced-vi (references/advanced-vi.md)
EnvironmentsTest environments: node, jsdom, happy-dom, customadvanced-environments (references/advanced-environments.md)
Type TestingType-level testing with expectTypeOf and assertTypeadvanced-type-testing (references/advanced-type-testing.md)
ProjectsMulti-project workspaces, different configs per projectadvanced-projects (references/advanced-projects.md)