jest-ts - Fast Jest TypeScript Transpiler
raw JSON → 1.1.22 verified Fri May 01 auth: no javascript
jest-ts is a high-performance Jest TypeScript transpiler powered by esbuild, offering 5-10x faster transpilation than ts-jest. Version 1.1.22 is the latest stable with a monthly release cadence. Key differentiators include intelligent caching based on code content, config, and package versions; on-demand type checking using the official TypeScript API that does not block test execution; and a one-click init command (npx jest-ts init) that generates config files, example code, and npm scripts. Supports Node.js and browser (jsdom) environments, and both CommonJS and ES modules. Requires jest >= 28.0.0 and TypeScript >= 5.0.0.
Common errors
error Cannot find module 'jest-ts/jest-preset' from 'jest.config.js' ↓
cause Preset path is incorrect or jest-ts not installed.
fix
Ensure jest-ts is installed: npm install jest-ts --save-dev. Verify preset: 'jest-ts/jest-preset'.
error Error: Jest: 'jest-ts' preset not found. Did you mean to use 'jest-ts/jest-preset'? ↓
cause Using preset: 'jest-ts' instead of 'jest-ts/jest-preset'.
fix
Change preset to 'jest-ts/jest-preset'.
error TypeError: jest_ts_1.default is not a function ↓
cause Incorrect import or CommonJS/ESM mismatch when using jest-ts transformer directly.
fix
Do not import jest-ts directly; use the preset in Jest config.
Warnings
breaking jest-ts requires jest >= 28.0.0 and typescript >= 5.0.0. Using older versions will cause errors. ↓
fix Upgrade jest to v28+ and TypeScript to v5+.
breaking Node.js version must be >=16.0.0 due to esbuild dependency. ↓
fix Use Node.js 16+ (currently LTS).
deprecated The 'jest-ts' preset path is 'jest-ts/jest-preset', not a simple 'jest-ts'. ↓
fix Use preset: 'jest-ts/jest-preset' in Jest config.
gotcha The globals key must be quoted: 'jest-ts' (string). ↓
fix Write globals: { 'jest-ts': { ... } } in JavaScript config.
Install
npm install jest-ts yarn add jest-ts pnpm add jest-ts Imports
- jest-ts/jest-preset wrong
preset: 'jest-ts' // Missing /jest-preset pathcorrectpreset: 'jest-ts/jest-preset' // in jest.config.js - globals['jest-ts'] wrong
globals: { jest-ts: { typeCheck: true } } // Without quotes, Jest may interpret as object keycorrectglobals: { 'jest-ts': { typeCheck: true } } // in jest.config.js - init command wrong
npm init jest-ts // Incorrect commandcorrectnpx jest-ts init
Quickstart
npm install jest-ts jest typescript --save-dev
npx jest-ts init
# Respond to prompts (e.g., overwrite files)
npm install
npm test
# Expected output: Test Suites: 1 passed, 1 total