vitest

Generates Vitest configuration, test setup, and sample tests for detected project types.

1|Updated Aug 18, 2026
One-click install
npx skills add https://github.com/scsm-unrestrict/dsh-frontend-engineer-agent --skill vitest-scsm-unrestrict
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vitest
Source: https://github.com/scsm-unrestrict/dsh-frontend-engineer-agent/tree/main/frontend-engineer/skills/vitest
Command: npx skills add https://github.com/scsm-unrestrict/dsh-frontend-engineer-agent --skill vitest-scsm-unrestrict

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up a testing framework from scratch involves many small decisions: which environment to use, how to configure TypeScript, what scripts to add, and how to write the first test. This Skill automates the entire Vitest setup by detecting your project type and generating working test infrastructure that passes on the first run. ## Core Features & Use Cases - Project Detection: Scans package.json, tsconfig.json, wrangler.toml, and vite.config.ts to classify the project as Cloudflare Workers, React (Vite), Node/Hono API, or library, then generates the matching configuration. - Complete Scaffolding: Produces vitest.config.ts, test setup files, TypeScript globals config, package.json scripts, and a sample test written against real source code. - Jest Migration: Converts existing Jest setups by mapping jest.* APIs to vi.* equivalents, removing Jest packages, and updating tsconfig types. - Use Case: You have a Hono API with no tests. Run this Skill to get a node-environment Vitest config, coverage reporting, test scripts, and a passing route test in one pass. ## Quick Start Set up Vitest testing in this project, detect the project type, and generate the config plus a sample test that passes.

Frequently Asked Questions about vitest

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

FAQPage Schema
How do I set up Vitest in a React project?

Install vitest, jsdom, and @testing-library/react, then add a test block with environment jsdom and a setupFiles entry to your vite.config.ts. Create src/test/setup.ts importing @testing-library/jest-dom/vitest, and add vitest/globals to tsconfig types.

How to migrate from Jest to Vitest?

Replace jest.* APIs with vi.* equivalents: jest.fn becomes vi.fn, jest.mock becomes vi.mock, and jest.useFakeTimers becomes vi.useFakeTimers. Remove Jest packages, swap tsconfig types from jest to vitest/globals, and generate a vitest.config.ts.

Does Vitest work with Cloudflare Workers?

Yes, use @cloudflare/vitest-pool-workers with defineWorkersConfig pointing at your wrangler.toml. If the project uses the Cloudflare Vite plugin, add the test block directly to the existing vite.config.ts instead.

Why do I get 'describe is not defined' in Vitest?

This error means globals are not enabled. Add globals: true to your Vitest config and include "types": ["vitest/globals"] in tsconfig.json compilerOptions, or import describe, it, and expect explicitly from vitest.

Why does my React test fail with 'document is not defined'?

The test is running in the default node environment, which has no DOM. Set environment: "jsdom" in your Vitest config for React component tests, and install jsdom as a dev dependency.