jest
Installation
SKILL.md
Jest
Jest is a delightful JavaScript Testing Framework with a focus on simplicity. It works with projects using: Babel, TypeScript, Node, React, Angular, Vue, and more.
When to Use
- JavaScript & TypeScript Unit Testing: Standard, battery-included test runner for React, Node.js, and legacy frontend projects.
- Snapshot Testing: Freezing and asserting on large rendered component output, GraphQL responses, or JSON configurations.
- Comprehensive Mocking Engine: Spying on, mocking, and stubbing functions, timers, and entire modules with
jest.mock(). - Code Coverage Reporting: Generating built-in Istanbul code coverage metrics without external plugins.
Quick Start
// sum.js
function sum(a, b) {
return a + b;
}
module.exports = sum;