Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default export (transformer)
✓ import esbuildJest from 'esbuild-jest'
Default export is the transformer function. Only named exports are Options types.
Options interface
✓ import type { Options } from 'esbuild-jest'
✗ import { Options } from 'esbuild-jest' (runtime error, type-only)
Options is a TypeScript type, not a value. Use type import.
require with CreateTransformerOptions?
✓ const transformer = require('esbuild-jest')
✗ const { default } = require('esbuild-jest')
CommonJS require returns the transformer directly, not under default.
Shows minimal Jest config using esbuild-jest transformer with sourcemap option and a basic test.
// jest.config.js
module.exports = {
transform: {
'^.+\\.(t|j)sx?$': ['esbuild-jest', { sourcemap: true }]
}
};
// your.test.ts
import { sum } from './sum';
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});
Errors
Common errors & fixes
Cannot find module 'esbuild-jest' from 'jest.config.js'
esbuild-jest not installed or esbuild peer dependency missing.
fixnpm install --save-dev esbuild-jest esbuild
TypeError: esbuildJest is not a function
Using named import Options as a function.
fixUse default import for transformer: import esbuildJest from 'esbuild-jest'
Jest encountered an unexpected token (tsx file)
Transform regex does not match .tsx files.
fixUpdate regex to '^.+\\.(t|j)sx?$' in jest config
Audit
Dependencies
esbuildrequiredRequired peer dependency for transformation