Agent skill · writing content · secondsky

jest-generator

Generate Jest unit tests for JavaScript/TypeScript with mocking, coverage. Use for JS/TS modules, React components, test generation, or encountering missing coverage, improper mocking, test structure errors.

Why this skill is useful

Provides specific Jest patterns and test generation techniques that the AI wouldn't reliably generate on its own.

What it needs

About 2k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.

What this skill does

Jest Generator Skill Purpose Generate Jest-based unit tests for JavaScript and TypeScript code, following Jest conventions and best practices with proper mocking, describe blocks, and code organization. When to Use Generate Jest tests for JavaScript/TypeScript modules Create test files for React components Add missing test coverage to existing code Need Jest-specific patterns (mocks, spies, snapshots) Test File Naming Source to Test Mapping: src/components/Feature.tsx → src/components/Feature.test.tsx src/utils/validator.ts → src/utils/validator.test.ts src/models/User.ts → src/models/User.test.ts Running Tests Jest Test Structure Jest-Specific Patterns Mocking Async Testing Timers Common Matchers React Component Testing Quality Checklist [ ] Test file properly named (<module>.test.ts) [ ] All exported functions/classes tested [ ] Happy path and edge cases included [ ] Error conditions tested [ ] External dependencies mocked [ ] Tests organized with describe blocks [ ] beforeEach/afterEach for setup/cleanup [ ] Descriptive test names [ ] Coverage ≥ 80% Best Practices 1. Use descriptive test names: should <expected> when <condition> 2. Organize with describe blocks 3. Mock external dependencies only 4. Test user behavior for components 5. Use test.each for parametrized tests 6. Keep tests independent 7. Test error conditions 8. Aim for 80%+ coverage

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills secondsky/jest-generator

View the source on GitHub

Browse the @skills marketplace