jest-generator
SolidGenerate 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.
Testing & QA 159 stars
25 forks Updated 2 weeks ago MIT
Install
Quality Score: 88/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# 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
```bash
# Preferred: Using bun (faster)
bun test
# Run specific file
bun test src/utils/validator.test.ts
# Run with coverage
bun test --coverage
# Watch mode
bun test --watch
# Alternative: Using npm
npm test
npm test -- --coverage
```
## Jest Test Structure
```typescript
import { functionToTest, ClassToTest } from './Feature'
jest.mock('./dependency')
describe('ModuleName', () => {
beforeEach(() => {
jest.clearAllMocks()
})
afterEach(() => {
jest.restoreAllMocks()
})
describe('ClassName', () => {
let instance: ClassToTest
beforeEach(() => {
instance = new ClassToTest()
})
it('should return expected result with valid input', () => {
// Arrange
const input = { key: 'value' }
const expected = { processed: true }
// Act
const result = ins...
Details
- Author
- secondsky
- Repository
- secondsky/claude-skills
- Created
- 6 months ago
- Last Updated
- 2 weeks ago
- Language
- TypeScript
- License
- MIT
Integrates with
Related Skills
Testing & QA Featured
rtk-tdd
Enforces TDD (Red-Green-Refactor) for Rust development. Auto-triggers on implementation, testing, refactoring, and bug fixing tasks. Provides Rust-idiomatic testing patterns with anyhow/thiserror, cfg(test), and Arrange-Act-Assert workflow.
55,551 Updated today
rtk-ai Testing & QA Featured
tdd-rust
TDD workflow for RTK filter development. Red-Green-Refactor with Rust idioms. Real fixtures, token savings assertions, snapshot tests with insta. Auto-triggers on new filter implementation.
55,551 Updated today
rtk-ai Testing & QA Featured
wordpress-penetration-testing
Assess WordPress installations for common vulnerabilities and WordPress 7.0 attack surfaces.
38,979 Updated today
sickn33