vitest

Optimize Vitest test suites with async patterns, mocking, and CI/CD performance tuning.

7|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/Cobalt-Money/Cobalt --skill vitest-cobalt-money
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vitest
Source: https://github.com/Cobalt-Money/Cobalt/tree/main/.agents/skills/vitest
Command: npx skills add https://github.com/Cobalt-Money/Cobalt --skill vitest-cobalt-money

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill addresses the common challenges of writing flaky, slow, or unmaintainable tests in the Vitest framework, ensuring your test suite remains a reliable asset rather than a maintenance burden.

Core Features & Use Cases

  • Async Testing Mastery: Provides critical patterns for handling promises, fake timers, and polling to eliminate race conditions.
  • Test Isolation & Mocking: Offers high-impact strategies for effective mocking and state cleanup to prevent cross-test contamination.
  • Performance Optimization: Includes advanced configurations for sharding, pool selection, and environment management to drastically reduce CI/CD feedback loops.

Quick Start

Ask the vitest skill to review your current test file for async anti-patterns and suggest improvements based on the critical rules.

Frequently Asked Questions about vitest

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

FAQPage Schema
How do I fix flaky Vitest tests caused by async race conditions?

Prevent cross-test contamination in Vitest by applying high-impact strategies for effective mocking and state cleanup. This test isolation ensures your suite remains a reliable asset rather than a maintenance burden.

How do I optimize Vitest performance for CI/CD pipelines?

Optimize Vitest performance for CI/CD by using advanced configurations for sharding, pool selection, and environment management. These tuning techniques drastically reduce feedback loops for JavaScript and TypeScript projects.

What is the best way to structure mocking in Vitest?

The best way to structure mocking in Vitest is to implement high-impact strategies for effective mocking and state cleanup. This prevents cross-test contamination and ensures consistent test isolation.

Does Vitest support fake timers for unit testing async operations?

Vitest supports fake timers for unit testing async operations through its critical async testing patterns. These patterns help handle promises and polling to eliminate race conditions in your test suite.