Registry / testing / esbuild-jest-fixed

esbuild-jest-fixed

JSON →
library0.5.2jsnpmunverified

A Jest transformer leveraging esbuild for fast TypeScript, JavaScript, TSX, and JSX compilation. Version 0.5.2 is the latest stable release; the project is a fork of esbuild-jest that resolves a critical bug where source code containing the substring "ock(" (e.g., "mock(") would cause compilation failures. It supports configurable jsxFactory, jsxFragment, sourcemap, loaders, target, and format options, and is designed as a drop-in replacement for ts-jest with significantly faster transpilation. Requires esbuild >=0.9.3 as a peer dependency. The package ships TypeScript type definitions.

npm install esbuild-jest-fixed
INSTALL
IMPORT
SIG · ESBUILD-JEST-FIXED
E
esbuild-jest-fixed
testingjavascriptv0.5.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

esbuild-jest-fixed
import createTransformer from 'esbuild-jest-fixed'
import { createTransformer } from 'esbuild-jest-fixed'
Package exports a default transformer factory; named export does not exist in v0.5.2
Options (type)
import type { Options } from 'esbuild-jest-fixed'
import { Options } from 'esbuild-jest-fixed' // Options is a type, not a runtime value
TypeScript type import only; using value import will fail at runtime
Jest config string reference
"esbuild-jest-fixed" in Jest transform config
"esbuild-jest" in config when using the fork
Package name in Jest config must exactly match 'esbuild-jest-fixed' to find the correct module

Configures Jest with esbuild-jest-fixed transformer to compile TypeScript files, demonstrates a basic test and implementation.

// jest.config.js module.exports = { transform: { '^.+\\.tsx?$': [ 'esbuild-jest-fixed', { sourcemap: true, target: 'es2020' } ] } }; // example.test.ts import { sum } from './sum'; test('sum adds numbers', () => { expect(sum(1, 2)).toBe(3); }); // sum.ts export function sum(a: number, b: number): number { return a + b; } // Run: npx jest
Debug
Known issues
breakingJest transform keys using 'esbuild-jest' will not work with the fixed fork; must use 'esbuild-jest-fixed'
fix
Replace 'esbuild-jest' with 'esbuild-jest-fixed' in Jest configuration transform patterns
affects: >=0.0.0
gotchaSource code containing substring 'ock(' (e.g., 'mock(' or 'block(') could cause compilation errors in original esbuild-jest <0.2.0; fixed fork resolves this
fix
Use esbuild-jest-fixed v0.5.2+ which patches the 'ock(' issue
affects: >=0.0.0
deprecatedThe original esbuild-jest package is no longer maintained; this fork is the active alternative
fix
Migrate to esbuild-jest-fixed for continued support and bug fixes
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'esbuild-jest' from 'jest.config.js'
Using 'esbuild-jest' in Jest config but package not installed or intended to use fork
fix
Install esbuild-jest-fixed and use 'esbuild-jest-fixed' in config
TypeError: createTransformer is not a function
Importing named export `createTransformer` instead of default import
fix
Use `import createTransformer from 'esbuild-jest-fixed'` (no braces)
Module build failed: Error: The package "esbuild" is required but not installed
Missing peer dependency esbuild
fix
Run `npm install esbuild --save-dev`
Upgrade
Version history
0.5.2latest on npm
Audit
Dependencies
esbuildrequiredRuntime peer dependency: provides the core bundler/transpiler used by the transformer
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-jest-fixed — npm install esbuild-jest-fixed · libregistry