testing-patterns

Generate typed factories, mocking setups, and CI coverage workflows for Vitest and Jest JavaScript/TypeScript projects.

1|Updated Apr 13, 2026
One-click install
npx skills add https://github.com/Inteligentsensingsolutions/tdd-dev-workflow --skill testing-patterns-inteligentsensingsolutions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-patterns
Source: https://github.com/Inteligentsensingsolutions/tdd-dev-workflow/tree/main/skills/testing-patterns
Command: npx skills add https://github.com/Inteligentsensingsolutions/tdd-dev-workflow --skill testing-patterns-inteligentsensingsolutions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about testing-patterns

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

FAQPage Schema
How do I set up typed test factories in Vitest or Jest?

Typed test factories in Vitest or Jest are created by generating concrete, reusable functions that produce strongly typed test data, minimizing duplication and reducing friction when building nested mock objects for unit and integration tests.

What's the best way to isolate integration tests using MSW and mocking strategies?

The best way to isolate integration tests is by applying MSW configurations alongside manual mocks and spies, ensuring reliable separation of external dependencies and stable test execution across your JavaScript and TypeScript projects.

How do I configure Testing Library with a shared test-utils provider for component tests?

Configuring Testing Library with a shared test-utils provider involves creating custom utilities with provider wrappers, enabling accessible queries, userEvent usage, and async assertions for maintainable component and hook tests.

Can I migrate a legacy Jest suite to Vitest while adding coverage thresholds and CI workflows?

Yes, you can migrate a legacy Jest suite to Vitest by applying compatible testing patterns, adding typed factories, MSW handlers, and configuring coverage thresholds with GitHub Actions integration for faster shardable test pipelines.

Why does my test coverage drop when using untyped mock data in TypeScript projects?

Test coverage drops because untyped mock data often lacks the structural completeness needed to execute all code paths, a problem solved by implementing typed test factories and strict coverage thresholds within your CI pipelines.