jest-skill
Jest Testing Skill
When to Use
Use this skill when you need generates Jest unit and integration tests in JavaScript or TypeScript. Covers mocking, snapshots, async testing, and React component testing. Use when user mentions "Jest", "describe/it/expect", "jest.mock", "toMatchSnapshot". Triggers on: "Jest", "expect().toBe()", "jest.mock",...
Examples are separate fragments needing actual implementation imports and the project Jest environment/transforms. The reference/playbook.md file is not bundled. CommonJS jest.mock examples do not directly apply to native ESM; inspect the installed version. Restore spies/timers in afterEach/finally even on assertion failure; remove test.only before committing. Update snapshots only after reviewing the intended semantic change, never to silence failures.
Core Patterns
Basic Test
describe('Calculator', () => {
let calc;
beforeEach(() => { calc = new Calculator(); });