What problem does it solve?
Tests in JavaScript and TypeScript projects are often brittle, untyped, and hard to maintain, causing slow feedback and frequent regressions. This guidance consolidates conventions, factory patterns, mocking strategies, and lifecycle best practices so teams can write clear, fast, and maintainable tests. It reduces friction when migrating frameworks or enforcing TDD discipline across a codebase.
Core Features & Use Cases
- Factory pattern recommendations to create typed, reusable test data and nested factories that minimize duplication.
- Mocking strategies, spies, manual mocks, and MSW patterns for reliable isolation of unit and integration tests.
- Testing Library guidance for accessible queries, userEvent usage, async assertions, and custom test utilities with provider wrappers.
- Coverage and CI patterns including coverage thresholds, GitHub Actions integration, and shardable test execution for faster pipelines.
- Use Case: Convert a legacy Jest suite to Vitest while adding typed factories, a shared test-utils provider, and MSW handlers for stable component and hook tests.
Quick Start
Ask the testing-patterns skill to generate typed test factories, a shared test-utils file, and example unit tests for a target module using either Vitest or Jest.