A powerful testing framework for Vite-based projects, providing fast execution and high compatibility with Jest APIs.

Install

mkdir -p .claude/skills/vitest && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1479" && unzip -o skill.zip -d .claude/skills/vitest && rm skill.zip

Installs to .claude/skills/vitest

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

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.
176 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Execute unit tests with native ESM and TypeScript support
  • Run tests in parallel using multi-threaded workers
  • Generate code coverage reports via V8 or Istanbul
  • Perform snapshot testing and module mocking
  • Run benchmarks using the bench fixture

How it works

Vitest integrates directly into the Vite transformation pipeline to provide fast test updates. It uses multi-threaded workers to execute test suites in parallel.

Inputs & outputs

You give it
Test files and configuration
You get back
Test execution results and coverage reports

When to use vitest

  • Write unit tests for application modules
  • Configure test coverage reporting
  • Mock external dependencies and services
  • Run tests in watch mode

About this skill

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
CLICommand line interface, commands and optionscore-cli
Test APItest/it function, modifiers like skip, only, concurrentcore-test-api
Describe APIdescribe/suite for grouping tests and nested suitescore-describe
Expect APIAssertions with toBe, toEqual, matchers and asymmetric matcherscore-expect
HooksbeforeEach, afterEach, beforeAll, afterAll, aroundEachcore-hooks

Features

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

Advanced

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

When not to use it

  • Projects not using Vite as a build tool
  • Environments requiring legacy non-ESM module systems

Prerequisites

Vite

Limitations

  • Requires Vite-compatible configuration
  • Snapshot testing relies on specific Vitest matchers

How it compares

It shares configuration and plugins with the Vite application, avoiding the need for separate test-specific build setups.

Compared to similar skills

vitest side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
vitest (this skill)416moNo flagsIntermediate
write-unit-tests53moReviewIntermediate
javascript-testing-patterns34moReviewBeginner
testing-patterns36moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry