Skip to content

Latest commit

 

History

History
76 lines (64 loc) · 3.11 KB

File metadata and controls

76 lines (64 loc) · 3.11 KB
id title
options
Options

Introduction

All ts-jest specific options are located under the globals.ts-jest path of your Jest config:

// jest.config.js
module.exports = {
  // [...]
  globals: {
    'ts-jest': {
      // ts-jest configuration goes here
    },
  },
}
// OR package.json
{
  // [...]
  "jest": {
    "globals": {
      "ts-jest": {
        // ts-jest configuration goes here
      }
    }
  }
}

IDE ts-jest config suggestion

To utilize IDE suggestions, you can use JSDoc comments to provide suggested ts-jest configs for your Jest config:

/** @typedef {import('ts-jest/dist/types')} */
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
  // [...]
  globals: {
    'ts-jest': {
      // ts-jest configuration goes here and your IDE will suggest which configs when typing
    },
  },
}

module.exports = config

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).

Option Description Type Default
compiler TypeScript module to use as compiler. string "typescript"
tsconfig or tsConfig(DEPRECATED) TypeScript compiler related configuration. string|object|boolean auto
isolatedModules Disable type-checking boolean disabled
astTransformers Custom TypeScript AST transformers object auto
diagnostics Diagnostics related configuration. boolean|object enabled
babelConfig Babel(Jest) related configuration. boolean|string|object disabled
stringifyContentPathRegex Files which will become modules returning self content. string|RegExp disabled