vitest

Configures Vitest projects with mocks, fixtures, and coverage reporting.

16|9|Updated Nov 6, 2013
One-click install
npx skills add https://github.com/erikstmartin/dotfiles --skill vitest-erikstmartin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vitest
Source: https://github.com/erikstmartin/dotfiles/tree/main/skills/catalog/frontend/vitest
Command: npx skills add https://github.com/erikstmartin/dotfiles --skill vitest-erikstmartin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides a structured guide to using Vitest for reliable, fast JavaScript/TypeScript testing across projects.

Core Features & Use Cases

  • Standardized Vitest workflows: mocking, coverage reporting, fixtures, test filtering, and concurrent testing patterns.
  • Practical usage: setting up vitest.config.ts, writing tests with test.extend fixtures, and using describe/ it APIs.
  • Real-world scenarios: configuring multi-project monorepos, running type checks alongside runtime tests, and integrating with CI.

Quick Start

Create a minimal vitest.config.ts and add a simple test to confirm the setup runs.

Frequently Asked Questions about vitest

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

FAQPage Schema
How do I set up a vitest.config.ts for multi-project monorepos?

You configure vitest.config.ts for multi-project monorepos by defining project-specific settings within the configuration file. This standardizes Vitest workflows across projects, ensuring tests remain repeatable and debuggable.

How does test.extend work for fixtures in Vitest?

The test.extend API in Vitest works by allowing you to define custom fixtures that are injected into your tests. This provides a structured guide to creating reusable test contexts, ensuring tests are maintainable.

What is the best way to structure mocks in Vitest?

The best way to structure mocks in Vitest is by applying standardized workflow patterns for consistent usage across unit and integration tests. This ensures your JavaScript and TypeScript tests remain reliable and debuggable.

Can I run type checks alongside runtime tests in Vitest?

Yes, you can run type checks alongside runtime tests in Vitest. This setup is supported in real-world scenarios, allowing you to validate TypeScript configurations and ensure tests are repeatable across your projects.

Does Vitest support concurrent testing patterns?

Yes, Vitest supports concurrent testing patterns to provide fast JavaScript and TypeScript testing. By configuring these patterns within your vitest.config.ts, you ensure tests are repeatable and maintainable across various scenarios.

Why are my Vitest coverage reports inconsistent?

Inconsistent Vitest coverage reports often stem from non-standardized workflows or incorrect vitest.config.ts settings. Applying structured guide patterns for coverage reporting ensures tests are repeatable, debuggable, and maintainable.