
Vitest
OfficialFreeA fast and modern testing framework for Vite apps.
Free · Opens the source repo
What Vitest does
Vitest is a testing framework designed specifically for projects built with Vite, offering a Jest-compatible API that is ready to use with native ESM, TypeScript, and JSX support. This framework leverages Vite's transformation pipeline, enabling rapid test updates similar to hot module replacement (HMR). With Vitest, developers can expect a seamless integration into their existing Vite applications, allowing them to run tests with minimal configuration.
One of the standout features of Vitest is its smart watch mode, which intelligently reruns only the tests affected by changes in the codebase, optimizing the testing process. Furthermore, it supports multi-threaded workers for parallel test execution, significantly improving performance for large test suites. Built-in coverage reporting through V8 or Istanbul provides insights into test coverage, while snapshot testing, mocking capabilities, and spy utilities enhance the testing experience.
This skill is particularly beneficial for developers working within the Vite ecosystem who want to adopt a modern testing approach without the overhead of additional configuration. It is suitable for both individual developers and teams looking to streamline their testing workflow, ensuring that tests are efficient and easy to manage. The extensive documentation provided in the bundled references allows users to dive deep into specific functionalities, from configuration to advanced type testing and mocking utilities.
In summary, Vitest offers a robust solution for testing Vite applications, combining speed, efficiency, and a familiar API for those transitioning from Jest. Its design caters to modern development practices, making it an essential tool for developers focused on optimizing their testing strategies.
When to use it
Use Vitest when developing applications with Vite and when you require a fast, Jest-compatible testing framework that supports modern JavaScript features.
When not to use it
Vitest may not be suitable for projects not using Vite or for teams that have established testing frameworks that do not require migration.
What you can build with it
Transitioning from Jest to Vitest
If you have an existing Jest test suite, you can easily migrate to Vitest to take advantage of its speed and Vite integration.
Optimizing test execution in Vite apps
Use Vitest to run tests in a Vite application, benefiting from its smart watch mode to only rerun affected tests.
Implementing advanced mocking in tests
Leverage Vitest's built-in mocking utilities to create complex test scenarios without external libraries.
How to install Vitest
View source1. Install with the skills CLI
npx skills add supabase/supabase/vitest --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by supabaseVitest 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 | core-config |
| CLI | Command line interface, commands and options | core-cli |
| Test API | test/it function, modifiers like skip, only, concurrent | core-test-api |
| Describe API | describe/suite for grouping tests and nested suites | core-describe |
| Expect API | Assertions with toBe, toEqual, matchers and asymmetric matchers | core-expect |
| Hooks | beforeEach, afterEach, beforeAll, afterAll, aroundEach | core-hooks |
Features
| Topic | Description | Reference |
|---|---|---|
| Mocking | Mock functions, modules, timers, dates with vi utilities | features-mocking |
| Snapshots | Snapshot testing with toMatchSnapshot and inline snapshots | features-snapshots |
| Coverage | Code coverage with V8 or Istanbul providers | features-coverage |
| Test Context | Test fixtures, context.expect, test.extend for custom fixtures | features-context |
| Concurrency | Concurrent tests, parallel execution, sharding | features-concurrency |
| Filtering | Filter tests by name, file patterns, tags | features-filtering |
Advanced
| Topic | Description | Reference |
|---|---|---|
| Vi Utilities | vi helper: mock, spyOn, fake timers, hoisted, waitFor | advanced-vi |
| Environments | Test environments: node, jsdom, happy-dom, 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 |
Frequently asked questions about Vitest
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
