vitest-docs

Answer Vitest documentation questions on test APIs, mocking, coverage, and configuration.

7|2|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/wenerme/ai --skill vitest-docs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vitest-docs
Source: https://github.com/wenerme/ai/tree/main/skills/vitest-docs
Command: npx skills add https://github.com/wenerme/ai --skill vitest-docs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps users quickly find correct, practical guidance for writing and configuring tests in Vitest, including mocking, coverage, browser/component testing, and Jest migration topics.

Core Features & Use Cases

  • Test API fundamentals: Coverage for core functions like describe, test, expect, vi, and lifecycle hooks (before/after).
  • Mocking & determinism: Guidance for mocking modules/functions/classes, timers/dates, filesystem, globals, and network requests.
  • Advanced testing modes: Snapshot testing, coverage providers (v8/istanbul), browser testing (Playwright/WebDriverIO), and React/Vue/Svelte component testing.
  • Configuration & tooling: Detailed reference for CLI commands, environment selection (node/jsdom/happy-dom/edge-runtime), projects/workspaces, parallelism, reporters, debugging, IDE integration, tags/filtering, and performance/migration tips.

Quick Start

Use the vitest-docs skill when you need to understand how to configure your Vitest test runner for mocking, coverage, or browser/component testing and how to apply the right CLI/config options.

Frequently Asked Questions about vitest-docs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from Jest to Vitest?

To migrate from Jest to Vitest, you update your testing configuration to leverage Vitest's Jest-compatible APIs. The skill provides guidance on adapting configuration files, replacing globals, and utilizing CLI options for a smooth migration transition.

What's the best way to configure code coverage in Vitest?

Configuring code coverage in Vitest involves selecting between v8 and istanbul coverage providers within your testing configuration. You can specify coverage settings to generate deterministic coverage reports based on your project requirements.

How do I mock modules and functions in Vitest tests?

You mock modules and functions in Vitest tests using the `vi` utility to modify testing behavior. The skill details mocking techniques for modules, functions, classes, timers, and network requests to ensure deterministic test outcomes.

Can I use Vitest for browser and component testing?

Yes, you can use Vitest for browser and component testing by configuring environments like happy-dom or jsdom. It supports component testing workflows for React, Vue, and Svelte, alongside browser testing via Playwright or WebDriverIO.

Does Vitest support snapshot testing workflows?

Yes, Vitest fully supports snapshot testing workflows to capture and compare component or function outputs. You can configure snapshot testing to ensure your application's UI and logic remain stable across code changes.

How do I configure environments like jsdom or edge-runtime in Vitest?

To configure environments like jsdom or edge-runtime in Vitest, you define the environment property in your testing configuration file. This allows you to simulate specific runtime behaviors for node, happy-dom, or edge-runtime test execution.