A Jest transformer that uses esbuild for fast compilation of TypeScript, JavaScript, JSX, and TSX files. Version 0.6.7 is the latest stable release, maintained as a fork of the abandoned esbuild-jest with active updates for Jest v29+. It integrates esbuild's blazing-fast bundler into the Jest transform pipeline, supporting custom loaders, sourcemaps, JSX factory/fragment configuration, and target/format options. Unlike ts-jest, which relies on tsc, esbuild-jest2 offers significantly faster transformation but does not enforce type checking. It requires esbuild >=0.20.1 as a peer dependency and ships TypeScript declarations.
npm install esbuild-jest2Verified import paths — ran on the pinned version, not inferred.
Configures Jest to transform .ts/.tsx files using esbuild-jest2 with sourcemaps, target es2020, and custom JSX settings.
Run a separate type-check step (e.g., `tsc --noEmit`) before or in parallel with tests.
Use correct string 'esbuild-jest2' in Jest transform configuration.
Update esbuild to >=0.20.1: `npm install esbuild@latest`
Migrate from esbuild-jest to esbuild-jest2 by changing package name and requiring esbuild >=0.20.1.
Use `import type { Options } from 'esbuild-jest2'`Run `npm install --save-dev esbuild-jest2` and ensure Jest config uses 'esbuild-jest2' (not 'esbuild-jest').
Change import to `import { createTransformer } from 'esbuild-jest2'` or `const { createTransformer } = require('esbuild-jest2')`.Set transform regex to include .tsx and .jsx (e.g., `'^.+\\.(ts|tsx|jsx)$'`) or ensure loader config includes 'tsx' for appropriate files.