javascript-testing-patterns
Installation
Summary
Comprehensive testing strategies for JavaScript/TypeScript using Jest, Vitest, and Testing Library.
- Covers unit testing, integration testing, and component testing with patterns for pure functions, classes, async code, and React hooks
- Includes mocking strategies: module mocking, dependency injection, and spying on functions for isolated test execution
- Provides API and database integration test examples with real request/response handling and transaction cleanup
- Supports snapshot testing, test fixtures, coverage reporting, and best practices like the AAA pattern and TDD workflows
SKILL.md
JavaScript Testing Patterns
Comprehensive guide for implementing robust testing strategies in JavaScript/TypeScript applications using modern testing frameworks and best practices.
When to Use This Skill
- Setting up test infrastructure for new projects
- Writing unit tests for functions and classes
- Creating integration tests for APIs and services
- Implementing end-to-end tests for user flows
- Mocking external dependencies and APIs
- Testing React, Vue, or other frontend components
- Implementing test-driven development (TDD)
- Setting up continuous testing in CI/CD pipelines