Skip to main content
Version: Next

Options

Introduction

caution

If you are using custom transform config, please remove preset from your Jest config to avoid issues that Jest doesn't transform files correctly.

All ts-jest specific options can be defined in Jest transform config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

/** @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',
{
// ts-jest configuration goes here
},
],
},
}
info

When using TypeScript Jest config file, Jest will use ts-node to compile the config file. ts-jest doesn't take part in that process.

Options

All options have default values which should fit most of the projects. Click on the option's name to see details and example(s).

OptionDescriptionTypeDefault
compilerTypeScript module to use as compiler.string"typescript"
tsconfigTypeScript compiler related configuration.string|object|booleanauto
isolatedModulesDisable type-checkingbooleandisabled
astTransformersCustom TypeScript AST transformersobjectauto
diagnosticsDiagnostics related configuration.boolean|objectenabled
babelConfigBabel(Jest) related configuration.boolean|string|objectdisabled
stringifyContentPathRegexFiles which will become modules returning self content.string|RegExpdisabled
useESMEnable ESM supportbooleanauto