cyberneticlibrary

Write unit tests with Vitest

vitestskillsetup L1381
majiayu000/claude-skill-registry
What it does

Write unit and integration tests with Vitest

Best for

Writing fast, Jest-compatible unit and integration tests for Vite projects with concurrent execution and type-safe TypeScript support.

Inputs
  • · Vite project source code
  • · Test cases and mocking requirements
Outputs
  • · vitest.config.ts configuration file
  • · .test.ts files with describe/it blocks
  • · Coverage reports and snapshot files
Requires
  • · Vitest npm package
  • · Vite bundler
  • · jsdom (if testing DOM) or node environment
Preconditions
  • · Vite project initialized
  • · Node.js and npm installed
  • · TypeScript configured (recommended)
Failure modes
  • · Import resolution fails if Vite alias not configured
  • · Tests hang on infinite loops or unresolved promises
  • · Snapshots become stale after code changes
  • · jsdom environment crashes on DOM manipulation
Trust signals
  • · Vitest is Vite-native (same build pipeline)
  • · Jest API compatibility reduces migration friction
  • · Reference files provided for config, mocking, and assertions