Set up Vitest testing in any project — detects type (Cloudflare Workers, React, Node, library), generates vitest.config.ts, test setup, utilities, and a sample test. Covers mocking patterns, coverage config, workspace setup, Jest migration. Use whenever the user mentions adding tests, setting up Vitest, configuring tests, migrating from Jest, fixing testing infrastructure, or asks 'how do I test this'.
This skill sets up Vitest testing infrastructure in an existing project by detecting the project type and generating tailored configuration and working test files. It solves the common friction of standing up a correct testing setup: rather than a reference card, it actively creates vitest.config.ts, a test setup file, utilities, and a sample test, then wires up package.json scripts and TypeScript config. It also supports migrating an existing Jest setup to Vitest.
The workflow is: detect, configure, scaffold, and wire up. Detection reads project files (package.json, tsconfig.json, wrangler.toml, vite.config.ts, existing vitest/jest config, and src structure) to classify the project as Cloudflare Workers, React (Vite), React SSR/TanStack Start, Node/Hono API, or a plain library, and to choose the right test environment (node, jsdom, or a split setup). It generates the appropriate install command using the project's detected package manager (pnpm, yarn, bun, or npm), including framework-specific dev dependencies and Cloudflare's vitest-pool-workers where relevant, and it removes Jest packages when migrating. It then emits the matching vitest.config.ts (extending an existing vite.config.ts rather than duplicating it), a React setup file importing jest-dom matchers, a tsconfig types entry for vitest globals, standard test scripts (test, test:run, test:coverage, test:ui), and a sample test that reflects the specific project. Coverage config via the v8 provider is included.
Target users are JavaScript and TypeScript developers and AI agents who want a correct, project-aware Vitest setup quickly, or who are migrating from Jest. As a test-scaffolding skill that installs dev dependencies and writes local config/test files, it performs only standard, benign development operations.
Cloudflare Workers, React (Vite), React SSR/TanStack Start, Node/Hono APIs, and plain libraries, each mapped to the correct Vitest environment (node, jsdom, or a split setup).
It creates files: vitest.config.ts, a test setup file, utilities, a sample test, plus package.json scripts and TypeScript config entries.
Yes. It detects a Jest config as a migration candidate and includes a command to remove Jest packages (jest, ts-jest, @types/jest, jest-environment-jsdom, babel-jest) as part of the switch.
It detects the project's package manager by lockfile (pnpm-lock.yaml, yarn.lock, bun.lockb, or package-lock.json) and generates install commands accordingly.
Yes. If a vite.config.ts already exists it adds the test block to it rather than creating a separate vitest.config.ts, since Vitest reads Vite config natively.
Quick Setup:
.claude/skills/Repository
jezweb/claude-skills