# Jest Setup

> Configure Jest for a TypeScript project — ts-jest, module mapping, and coverage thresholds.

- Skill: `alexngai/jest-setup` (Agent Skill)
- Install (CLI): `npx skillmds@latest add alexngai/jest-setup`
- Raw SKILL.md: https://api.skillmd.com/api/skills/alexngai/jest-setup/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: alexngai (https://skillmd.com/u/alexngai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/alexngai/jest-setup

---


# Jest Setup (TypeScript)

1. Install `jest`, `ts-jest`, and `@types/jest`.
2. `jest.config.ts`: set `preset: 'ts-jest'` and `testEnvironment: 'node'` (or `jsdom` for UI).
3. Map path aliases with `moduleNameMapper` so `@/x` resolves like your bundler.
4. Gate CI with `coverageThreshold` so coverage can't silently regress.

