Skip to main content
Version: Next

useESM option

The useESM option allows ts-jest to transform codes to ESM syntax if possible.

The default value is false, ts-jest will transform codes to CommonJS syntax.

Examples

/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
transform: {
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
}