# Skill: javascript-testing-patterns

> Implement comprehensive testing strategies using Jest, Vitest, and Testing Library for unit tests, integration tests, and end-to-end testing with mocking, fixtures, and test-driven development. Use when writing JavaScript/TypeScript tests, setting up test infrastructure, or implementing TDD/BDD workflows.

*Digest only: full text not redistributed here.*

## Outline
- When to Use This Skill
- Testing Frameworks
- Jest - Full-Featured Testing Framework
- Vitest - Fast, Vite-Native Testing
- Unit Testing Patterns
- Pattern 1: Testing Pure Functions
- Pattern 2: Testing Classes
- Pattern 3: Testing Async Functions
- Mocking Patterns
- Pattern 1: Mocking Modules
- Pattern 2: Dependency Injection for Testing
- Pattern 3: Spying on Functions
- Integration Testing
- Frontend Testing with Testing Library
- Test Fixtures and Factories
- Best Practices
