vitest

Run Jest-compatible unit tests for JavaScript and TypeScript projects with Vite-native transforms.

Updated May 15, 2026
One-click install
npx skills add https://github.com/JBonfim/skill-developer --skill vitest-jbonfim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vitest
Source: https://github.com/JBonfim/skill-developer/tree/main/.agents/skills/vitest
Command: npx skills add https://github.com/JBonfim/skill-developer --skill vitest-jbonfim

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Vitest eliminates slow, brittle test workflows by providing a Jest-compatible unit testing framework that runs efficiently alongside Vite.

Core Features & Use Cases

  • Jest-compatible API: Use familiar test, expect, describe, and assertion patterns while leveraging Vitest’s native behavior.
  • Vite-native execution: Transform, resolve, and run tests through Vite’s pipeline for fast iteration and consistent module handling.
  • Real-world test needs: Mocking with vi, DOM testing via environments like jsdom, snapshots, coverage, and advanced filtering for CI.

Quick Start

Use the vitest skill to add and run unit tests for your Vite-based codebase with Jest-like syntax.

Frequently Asked Questions about vitest

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

FAQPage Schema
How do I write unit tests for a Vite project using a Jest-compatible API?

Write unit tests for Vite projects using Vitest's Jest-compatible API, defining tests with `test` and `describe`, asserting with `expect`, and executing transforms natively through Vite's pipeline for fast, reliable iteration.

How do I configure vitest.config.ts options for code coverage and test filtering?

Configure `vitest.config.ts` to enable code coverage and filter specific tests for CI. This test runner configuration supports defining projects, environments, and snapshots to manage execution scope.

Can I use mocking and jsdom environments for DOM testing in Vitest?

Yes, you can use jsdom environments for DOM testing and apply mocking with `vi` utilities. Vitest supports module stubbing, mocking, and timer manipulation to isolate real-world test scenarios.

What is the best way to migrate Jest tests to a Vite-native runner?

Migrating Jest tests to Vitest provides Vite-native execution and consistent module handling. You reuse familiar `test`, `expect`, and `describe` assertion patterns while leveraging Vitest's native transforms.

Does Vitest support TypeScript test files and module stubbing?

Yes, Vitest supports TypeScript test files and module stubbing. It transforms and resolves tests through Vite's pipeline, using `vi` utilities to mock modules, stub dependencies, and manipulate timers.

When do I need to use snapshots and fixtures in unit testing?

Use snapshots and fixtures in unit testing to capture component output and manage test data. Vitest supports these real-world test needs alongside mocking and coverage to ensure reliable JavaScript validation.