What problem does it solve?
This Skill provides a comprehensive guide to using Jest, the industry-standard testing framework, for TypeScript projects, enabling developers to write reliable, maintainable, and efficient tests.
Core Features & Use Cases
- Setup & Configuration: Detailed instructions for
jest.config.js and tsconfig.json.
- Core Patterns: Examples for basic tests, type-safe tests, and data-driven tests using
.each.
- Mocking: Advanced techniques for module mocking (
jest.mock), method spying (jest.spyOn), and type-safe mock functions.
- React Testing: Integration with React Testing Library for component and hook testing.
- Snapshot Testing: Strategies for UI regression testing and updating snapshots.
- Async Testing: Handling promises and callbacks effectively.
- Coverage: Configuring and running code coverage reports.
- Migration: Guidance on migrating from Vitest to Jest.
- Use Case: A developer needs to set up a robust testing suite for a new TypeScript React application, ensuring all components and utility functions are thoroughly tested with mocks and coverage reports.
Quick Start
Use the Jest skill to set up a new Jest configuration file for a TypeScript project.