- Home
- Skills
- Ehtbanton
- Claudeskillsrepo
- Jest Config Generator
jest-config-generator_skill
- TypeScript
0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill ehtbanton/claudeskillsrepo --skill jest-config-generator- SKILL.md9.8 KB
Overview
This skill generates complete, ready-to-use Jest configuration files for JavaScript and TypeScript projects. It produces jest.config.js, jest.config.ts, or jest.config.json with sensible defaults for coverage, transforms, module resolution, and environment-specific settings. Use it to quickly bootstrap testing configs for Node APIs, React apps, Next.js, monorepos, or packages.
How this skill works
On request it detects the project type (TypeScript Node, React/Vite/CRA, Next.js, API backend, monorepo, or single package) and returns a tailored Jest configuration file. Each template includes testEnvironment, transforms (ts-jest or babel-jest), moduleNameMapper for common path aliases and asset mocks, coverage settings and thresholds, setup files, and performance/timeouts. It also flags missing setup files or mismatched tsconfig path aliases so you can adjust before saving.
When to use it
- Bootstrapping tests for a new TypeScript Node API
- Adding Jest to a React app using Vite or CRA with React Testing Library
- Creating a Next.js-compatible Jest config (App Router supported)
- Standardizing Jest configs across a monorepo or multiple packages
- Generating project-specific coverage and mock rules quickly
Best practices
- Match testEnvironment to runtime: 'node' for backends, 'jsdom' for frontend DOM tests
- Keep transforms aligned with your build tool: ts-jest for TS, babel-jest for JS/JSX when using Babel
- Sync moduleNameMapper with tsconfig paths to avoid unresolved imports in tests
- Exclude generated, story, and type files from coverage to get meaningful metrics
- Add setupFilesAfterEnv for global mocks (e.g., jest-dom, IntersectionObserver) and note required files if missing
Example use cases
- Create Jest config for a TypeScript Node.js API with ts-jest, coverage, and path aliases
- Generate a React app config with jsdom, CSS and file mocks, and RTL setup file
- Produce a Next.js Jest config using next/jest and app-router-aware settings
- Create a root monorepo Jest config that references per-package jest.config.js files
- Generate a package-level jest.config.js with displayName and preset for shared libraries
FAQ
Yes. Templates can be output as CommonJS (module.exports) or ESM (export default) or as JSON when needed, but ensure Jest version and project package.json support the chosen module type.
What if my tsconfig path aliases differ?
The generator includes common alias examples and will note that moduleNameMapper should be adjusted to exactly match your tsconfig.json paths before running tests.