Testing 699 installs

javascript-testing-patterns

by wshobson/agents

Implement comprehensive testing strategies using Jest, Vitest, and Testing Library for unit tests, integration tests, and end-to-end testing with mocking,…

Skill content

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

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

Testing Frameworks

Jest - Full-Featured Testing Framework