testing

Automate test writing and review for WrongStack TypeScript projects using vitest.

224|27|Updated May 12, 2026
One-click install
npx skills add https://github.com/WrongStack/WrongStack --skill testing-wrongstack
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/WrongStack/WrongStack/tree/main/packages/core/skills/testing
Command: npx skills add https://github.com/WrongStack/WrongStack --skill testing-wrongstack

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writes and reviews tests for WrongStack TypeScript code to ensure reliable, maintainable test suites across the project.

Core Features & Use Cases

  • Co-locate tests with implementation files (src/foo.ts → tests/foo.test.ts) to keep tests close to code.
  • Focus on testing public API surfaces and behavior, not internal details.
  • Use vi.mock() for external dependencies to ensure stable, predictable tests.
  • Enforce async test timeouts and mock timers to handle debounce/throttle scenarios.
  • Maintain code quality with a 70%+ test coverage gate and isolated test environments.
  • Support unit, integration, and E2E testing patterns within a pnpm workspaces setup.

Quick Start

Run the unit test suite with vitest to verify public APIs and test patterns are working.

Frequently Asked Questions about testing

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

FAQPage Schema
How do I write co-located tests with Vitest in a pnpm workspaces setup?

Co-located tests with Vitest keep test files next to implementation files, mapping src/foo.ts to tests/foo.test.ts. This pattern in pnpm workspaces ensures tests remain close to code for easier maintenance across unit, integration, and E2E scenarios.

What's the best way to mock external dependencies in Vitest?

Mock external dependencies in Vitest using vi.mock() to ensure stable, predictable tests. This approach isolates test environments by replacing external modules, preventing flaky tests caused by network calls or third-party service changes.

How do I enforce test coverage thresholds in a TypeScript project?

Enforce test coverage thresholds in TypeScript by configuring Vitest to maintain a 70%+ coverage gate. This threshold ensures code quality by failing the test suite when coverage drops below the required minimum.

Can I use Vitest to test debounce and throttle scenarios with async timeouts?

Vitest supports testing debounce and throttle scenarios by enforcing async test timeouts and using mock timers. This handles time-based logic predictably without waiting for real delays in your test suite.

Does this testing approach focus on internal implementation details or public APIs?

This testing approach focuses on testing public API surfaces and behavior rather than internal implementation details. Testing public APIs ensures your tests remain stable during refactoring and accurately validate user-facing functionality.