typescript-testing
Installation
SKILL.md
TypeScript Testing Rules
Prerequisite Detection
Inspect package.json, the lockfile, test configuration, and existing test imports before selecting a framework or command. Apply Vitest-specific rules only when Vitest is configured; otherwise use the repository's configured TypeScript test harness while preserving the behavior, isolation, and evidence rules below. If no runnable harness is identifiable, report the inspected paths and missing command or configuration.
Test Framework
- Vitest: Use when selected by repository configuration or existing tests
- Test imports:
import { describe, it, expect, beforeEach, vi } from 'vitest' - Mock creation: Use
vi.mock()
Basic Testing Policy
Quality Requirements
- Regression protection: concentrate tests on critical paths, business logic, and behavior whose regression would matter. Add a test when an unguarded behavior creates a material regression risk
- Independence: Each test can run independently without depending on other tests
- Reproducibility: Control time, randomness, environment values, and external I/O so identical inputs produce the same observable result
- Readability: Each test names one behavior, separates setup/action/assertion, and keeps fixtures limited to values used by that behavior