ts-jest

  • Version 29.1.2
  • Published
  • 308 kB
  • 8 dependencies
  • MIT license

Install

npm i ts-jest
yarn add ts-jest
pnpm add ts-jest

Overview

A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable _default

const _default: {
createTransformer(tsJestConfig?: TsJestGlobalOptions): TsJestTransformer;
};

    variable DECLARATION_TYPE_EXT

    const DECLARATION_TYPE_EXT: string;

      variable JS_EXT_TO_TREAT_AS_ESM

      const JS_EXT_TO_TREAT_AS_ESM: string[];

        variable JS_JSX_EXTENSIONS

        const JS_JSX_EXTENSIONS: string[];

          variable JS_JSX_REGEX

          const JS_JSX_REGEX: RegExp;

            variable LINE_FEED

            const LINE_FEED: string;

              variable rootLogger

              let rootLogger: any;

                variable TS_EXT_TO_TREAT_AS_ESM

                const TS_EXT_TO_TREAT_AS_ESM: string[];

                  variable TS_TSX_REGEX

                  const TS_TSX_REGEX: RegExp;

                    Functions

                    function createJestPreset

                    createJestPreset: (
                    legacy?: boolean,
                    allowJs?: boolean,
                    extraOptions?: Config.InitialOptions
                    ) => TsJestPresets;

                      function parse

                      parse: (input: string) => any;

                        function pathsToModuleNameMapper

                        pathsToModuleNameMapper: (
                        mapping: any,
                        {
                        prefix,
                        useESM,
                        }?: { prefix?: string | undefined; useESM?: boolean | undefined }
                        ) => Config.InitialOptions;

                          function stringify

                          stringify: (input: unknown) => string;

                            Classes

                            class ConfigSet

                            class ConfigSet {}

                              constructor

                              constructor(jestConfig: any, parentLogger?: any);

                                property cacheSuffix

                                cacheSuffix: string;

                                  property compilerModule

                                  readonly compilerModule: any;

                                    property cwd

                                    readonly cwd: string;

                                      property isolatedModules

                                      readonly isolatedModules: boolean;

                                        property logger

                                        readonly logger: Logger;

                                          property parentLogger

                                          readonly parentLogger?: any;

                                            property parsedTsConfig

                                            parsedTsConfig: any;

                                              property resolvedTransformers

                                              resolvedTransformers: TsJestAstTransformer;

                                                property rootDir

                                                readonly rootDir: string;

                                                  property tsCacheDir

                                                  tsCacheDir: string;

                                                    property tsJestDigest

                                                    readonly tsJestDigest: string;
                                                    • Use by e2e, don't mark as internal

                                                    property useESM

                                                    useESM: boolean;

                                                      method isTestFile

                                                      isTestFile: (fileName: string) => boolean;

                                                        method raiseDiagnostics

                                                        raiseDiagnostics: (
                                                        diagnostics: ts.Diagnostic[],
                                                        filePath?: string,
                                                        logger?: Logger
                                                        ) => void;

                                                          method resolvePath

                                                          resolvePath: (
                                                          inputPath: string,
                                                          {
                                                          throwIfMissing,
                                                          nodeResolve,
                                                          }?: { throwIfMissing?: boolean; nodeResolve?: boolean }
                                                          ) => string;

                                                            method shouldReportDiagnostics

                                                            shouldReportDiagnostics: (filePath: string) => boolean;

                                                              method shouldStringifyContent

                                                              shouldStringifyContent: (filePath: string) => boolean;

                                                                class JsonableValue

                                                                class JsonableValue<V = Record<string, any>> {}

                                                                  constructor

                                                                  constructor(value: {});

                                                                    property serialized

                                                                    readonly serialized: string;

                                                                      property value

                                                                      value: {};

                                                                        method toString

                                                                        toString: () => string;

                                                                          method valueOf

                                                                          valueOf: () => V;

                                                                            class TsCompiler

                                                                            class TsCompiler implements TsCompilerInstance {}

                                                                              constructor

                                                                              constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);

                                                                                property configSet

                                                                                readonly configSet: ConfigSet;

                                                                                  property program

                                                                                  program: any;

                                                                                    property runtimeCacheFS

                                                                                    readonly runtimeCacheFS: StringMap;

                                                                                      method getCompiledOutput

                                                                                      getCompiledOutput: (
                                                                                      fileContent: string,
                                                                                      fileName: string,
                                                                                      options: TsJestCompileOptions
                                                                                      ) => CompiledOutput;

                                                                                        method getResolvedModules

                                                                                        getResolvedModules: (
                                                                                        fileContent: string,
                                                                                        fileName: string,
                                                                                        runtimeCacheFS: StringMap
                                                                                        ) => string[];

                                                                                          class TsJestCompiler

                                                                                          class TsJestCompiler implements CompilerInstance {}

                                                                                            constructor

                                                                                            constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);

                                                                                              method getCompiledOutput

                                                                                              getCompiledOutput: (
                                                                                              fileContent: string,
                                                                                              fileName: string,
                                                                                              options: TsJestCompileOptions
                                                                                              ) => CompiledOutput;

                                                                                                method getResolvedModules

                                                                                                getResolvedModules: (
                                                                                                fileContent: string,
                                                                                                fileName: string,
                                                                                                runtimeCacheFS: StringMap
                                                                                                ) => string[];

                                                                                                  class TsJestTransformer

                                                                                                  class TsJestTransformer implements SyncTransformer<TsJestTransformerOptions> {}

                                                                                                    constructor

                                                                                                    constructor(tsJestConfig?: TsJestGlobalOptions);

                                                                                                      method getCacheKey

                                                                                                      getCacheKey: (
                                                                                                      fileContent: string,
                                                                                                      filePath: string,
                                                                                                      transformOptions: TransformOptions<TsJestGlobalOptions>
                                                                                                      ) => string;
                                                                                                      • Jest uses this to cache the compiled version of a file

                                                                                                        See Also

                                                                                                        • https://github.com/facebook/jest/blob/v23.5.0/packages/jest-runtime/src/script_transformer.js#L61-L90

                                                                                                        Modifiers

                                                                                                        • @public

                                                                                                      method getCacheKeyAsync

                                                                                                      getCacheKeyAsync: (
                                                                                                      sourceText: string,
                                                                                                      sourcePath: string,
                                                                                                      transformOptions: TransformOptions<TsJestGlobalOptions>
                                                                                                      ) => Promise<string>;

                                                                                                        method process

                                                                                                        process: (
                                                                                                        sourceText: string,
                                                                                                        sourcePath: string,
                                                                                                        transformOptions: TransformOptions<TsJestGlobalOptions>
                                                                                                        ) => TransformedSource;
                                                                                                        • Modifiers

                                                                                                          • @public

                                                                                                        method processAsync

                                                                                                        processAsync: (
                                                                                                        sourceText: string,
                                                                                                        sourcePath: string,
                                                                                                        transformOptions: TransformOptions<TsJestGlobalOptions>
                                                                                                        ) => Promise<TransformedSource>;

                                                                                                          Interfaces

                                                                                                          interface AstTransformer

                                                                                                          interface AstTransformer<T = Record<string, unknown>> {}

                                                                                                            property options

                                                                                                            options?: T;

                                                                                                              property path

                                                                                                              path: string;

                                                                                                                interface AstTransformerDesc

                                                                                                                interface AstTransformerDesc<T = Record<string, unknown>> {}

                                                                                                                  property name

                                                                                                                  name: string;

                                                                                                                    property options

                                                                                                                    options?: T;

                                                                                                                      property version

                                                                                                                      version: number;

                                                                                                                        method factory

                                                                                                                        factory: (
                                                                                                                        tsCompiler: TsCompilerInstance,
                                                                                                                        opts?: T
                                                                                                                        ) =>
                                                                                                                        | _ts.TransformerFactory<_ts.SourceFile>
                                                                                                                        | _ts.TransformerFactory<_ts.Bundle | _ts.SourceFile>;

                                                                                                                          interface CompiledOutput

                                                                                                                          interface CompiledOutput extends TransformedSource {}

                                                                                                                            property diagnostics

                                                                                                                            diagnostics?: _ts.Diagnostic[];

                                                                                                                              interface CompilerInstance

                                                                                                                              interface CompilerInstance {}

                                                                                                                                method getCompiledOutput

                                                                                                                                getCompiledOutput: (
                                                                                                                                fileContent: string,
                                                                                                                                fileName: string,
                                                                                                                                options: TsJestCompileOptions
                                                                                                                                ) => CompiledOutput;

                                                                                                                                  method getResolvedModules

                                                                                                                                  getResolvedModules: (
                                                                                                                                  fileContent: string,
                                                                                                                                  fileName: string,
                                                                                                                                  runtimeCacheFS: StringMap
                                                                                                                                  ) => string[];

                                                                                                                                    interface ConfigCustomTransformer

                                                                                                                                    interface ConfigCustomTransformer {}

                                                                                                                                      property after

                                                                                                                                      after?: Array<string | AstTransformer>;

                                                                                                                                        property afterDeclarations

                                                                                                                                        afterDeclarations?: Array<string | AstTransformer>;

                                                                                                                                          property before

                                                                                                                                          before?: Array<string | AstTransformer>;

                                                                                                                                            interface DepGraphInfo

                                                                                                                                            interface DepGraphInfo {}

                                                                                                                                              property fileContent

                                                                                                                                              fileContent: string;

                                                                                                                                                property resolvedModuleNames

                                                                                                                                                resolvedModuleNames: string[];

                                                                                                                                                  interface GlobalConfigTsJest

                                                                                                                                                  interface GlobalConfigTsJest extends Config.ConfigGlobals {}
                                                                                                                                                  • For typings in jest.config.ts

                                                                                                                                                    Deprecated

                                                                                                                                                    use JestConfigWithTsJest instead

                                                                                                                                                  property 'ts-jest'

                                                                                                                                                  'ts-jest'?: TsJestGlobalOptions;

                                                                                                                                                    interface InitialOptionsTsJest

                                                                                                                                                    interface InitialOptionsTsJest extends Config.InitialOptions {}
                                                                                                                                                    • Deprecated

                                                                                                                                                      use JestConfigWithTsJest instead

                                                                                                                                                    property globals

                                                                                                                                                    globals?: GlobalConfigTsJest;

                                                                                                                                                      interface JestConfigWithTsJest

                                                                                                                                                      interface JestConfigWithTsJest extends Omit<Config.InitialOptions, 'transform'> {}

                                                                                                                                                        property transform

                                                                                                                                                        transform?: {
                                                                                                                                                        [regex: string]:
                                                                                                                                                        | 'ts-jest'
                                                                                                                                                        | 'ts-jest/legacy'
                                                                                                                                                        | ['ts-jest', TsJestTransformerOptions]
                                                                                                                                                        | ['ts-jest/legacy', TsJestTransformerOptions]
                                                                                                                                                        | string
                                                                                                                                                        | Config.TransformerConfig;
                                                                                                                                                        };

                                                                                                                                                          interface ProjectConfigTsJest

                                                                                                                                                          interface ProjectConfigTsJest extends Config.ProjectConfig {}
                                                                                                                                                          • For transformers which extends ts-jest

                                                                                                                                                            Deprecated

                                                                                                                                                            use JestConfigWithTsJest instead

                                                                                                                                                          property globals

                                                                                                                                                          globals: GlobalConfigTsJest;

                                                                                                                                                            interface RawCompilerOptions

                                                                                                                                                            interface RawCompilerOptions {}

                                                                                                                                                              property allowJs

                                                                                                                                                              allowJs?: boolean;
                                                                                                                                                              • Allow JavaScript files to be a part of your program. Use the checkJS option to get errors from these files.

                                                                                                                                                              property allowSyntheticDefaultImports

                                                                                                                                                              allowSyntheticDefaultImports?: boolean;
                                                                                                                                                              • Allow 'import x from y' when a module doesn't have a default export.

                                                                                                                                                              property allowUmdGlobalAccess

                                                                                                                                                              allowUmdGlobalAccess?: boolean;
                                                                                                                                                              • Allow accessing UMD globals from modules.

                                                                                                                                                              property allowUnreachableCode

                                                                                                                                                              allowUnreachableCode?: boolean;
                                                                                                                                                              • Disable error reporting for unreachable code.

                                                                                                                                                              property allowUnusedLabels

                                                                                                                                                              allowUnusedLabels?: boolean;
                                                                                                                                                              • Disable error reporting for unused labels.

                                                                                                                                                              property alwaysStrict

                                                                                                                                                              alwaysStrict?: boolean;
                                                                                                                                                              • Ensure 'use strict' is always emitted.

                                                                                                                                                              property assumeChangesOnlyAffectDirectDependencies

                                                                                                                                                              assumeChangesOnlyAffectDirectDependencies?: boolean;
                                                                                                                                                              • Have recompiles in projects that use incremental and watch mode assume that changes within a file will only affect files directly depending on it.

                                                                                                                                                              property baseUrl

                                                                                                                                                              baseUrl?: string;
                                                                                                                                                              • Specify the base directory to resolve non-relative module names.

                                                                                                                                                              property charset

                                                                                                                                                              charset?: string;
                                                                                                                                                              • No longer supported. In early versions, manually set the text encoding for reading files.

                                                                                                                                                              property checkJs

                                                                                                                                                              checkJs?: boolean;
                                                                                                                                                              • Enable error reporting in type-checked JavaScript files.

                                                                                                                                                              property composite

                                                                                                                                                              composite?: boolean;
                                                                                                                                                              • Enable constraints that allow a TypeScript project to be used with project references.

                                                                                                                                                              property declaration

                                                                                                                                                              declaration?: boolean;
                                                                                                                                                              • Generate .d.ts files from TypeScript and JavaScript files in your project.

                                                                                                                                                              property declarationDir

                                                                                                                                                              declarationDir?: string | null;
                                                                                                                                                              • Specify the output directory for generated declaration files.

                                                                                                                                                              property declarationMap

                                                                                                                                                              declarationMap?: boolean;
                                                                                                                                                              • Create sourcemaps for d.ts files.

                                                                                                                                                              property diagnostics

                                                                                                                                                              diagnostics?: boolean;
                                                                                                                                                              • Output compiler performance information after building.

                                                                                                                                                              property disableReferencedProjectLoad

                                                                                                                                                              disableReferencedProjectLoad?: boolean;
                                                                                                                                                              • Reduce the number of projects loaded automatically by TypeScript.

                                                                                                                                                              property disableSizeLimit

                                                                                                                                                              disableSizeLimit?: boolean;
                                                                                                                                                              • Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.

                                                                                                                                                              property disableSolutionSearching

                                                                                                                                                              disableSolutionSearching?: boolean;
                                                                                                                                                              • Opt a project out of multi-project reference checking when editing.

                                                                                                                                                              property disableSourceOfProjectReferenceRedirect

                                                                                                                                                              disableSourceOfProjectReferenceRedirect?: boolean;
                                                                                                                                                              • Disable preferring source files instead of declaration files when referencing composite projects

                                                                                                                                                              property downlevelIteration

                                                                                                                                                              downlevelIteration?: boolean;
                                                                                                                                                              • Emit more compliant, but verbose and less performant JavaScript for iteration.

                                                                                                                                                              property emitBOM

                                                                                                                                                              emitBOM?: boolean;
                                                                                                                                                              • Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.

                                                                                                                                                              property emitDeclarationOnly

                                                                                                                                                              emitDeclarationOnly?: boolean;
                                                                                                                                                              • Only output d.ts files and not JavaScript files.

                                                                                                                                                              property emitDecoratorMetadata

                                                                                                                                                              emitDecoratorMetadata?: boolean;
                                                                                                                                                              • Emit design-type metadata for decorated declarations in source files.

                                                                                                                                                              property esModuleInterop

                                                                                                                                                              esModuleInterop?: boolean;
                                                                                                                                                              • Emit additional JavaScript to ease support for importing CommonJS modules. This enables allowSyntheticDefaultImports for type compatibility.

                                                                                                                                                              property experimentalDecorators

                                                                                                                                                              experimentalDecorators?: boolean;
                                                                                                                                                              • Enable experimental support for TC39 stage 2 draft decorators.

                                                                                                                                                              property extendedDiagnostics

                                                                                                                                                              extendedDiagnostics?: boolean;
                                                                                                                                                              • Output more detailed compiler performance information after building.

                                                                                                                                                              property fallbackPolling

                                                                                                                                                              fallbackPolling?:
                                                                                                                                                              | 'fixedPollingInterval'
                                                                                                                                                              | 'priorityPollingInterval'
                                                                                                                                                              | 'dynamicPriorityPolling';
                                                                                                                                                              • Specify what approach the watcher should use if the system runs out of native file watchers.

                                                                                                                                                              property forceConsistentCasingInFileNames

                                                                                                                                                              forceConsistentCasingInFileNames?: boolean;
                                                                                                                                                              • Ensure that casing is correct in imports.

                                                                                                                                                              property generateCpuProfile

                                                                                                                                                              generateCpuProfile?: string;
                                                                                                                                                              • Emit a v8 CPU profile of the compiler run for debugging.

                                                                                                                                                              property importHelpers

                                                                                                                                                              importHelpers?: boolean;
                                                                                                                                                              • Allow importing helper functions from tslib once per project, instead of including them per-file.

                                                                                                                                                              property importsNotUsedAsValues

                                                                                                                                                              importsNotUsedAsValues?: 'remove' | 'preserve' | 'error';
                                                                                                                                                              • Specify emit/checking behavior for imports that are only used for types.

                                                                                                                                                              property incremental

                                                                                                                                                              incremental?: boolean;
                                                                                                                                                              • Save .tsbuildinfo files to allow for incremental compilation of projects.

                                                                                                                                                              property inlineSourceMap

                                                                                                                                                              inlineSourceMap?: boolean;
                                                                                                                                                              • Include sourcemap files inside the emitted JavaScript.

                                                                                                                                                              property inlineSources

                                                                                                                                                              inlineSources?: boolean;
                                                                                                                                                              • Include source code in the sourcemaps inside the emitted JavaScript.

                                                                                                                                                              property isolatedModules

                                                                                                                                                              isolatedModules?: boolean;
                                                                                                                                                              • Ensure that each file can be safely transpiled without relying on other imports.

                                                                                                                                                              property jsx

                                                                                                                                                              jsx?: 'preserve' | 'react' | 'react-jsx' | 'react-jsxdev' | 'react-native';
                                                                                                                                                              • Specify what JSX code is generated.

                                                                                                                                                              property jsxFactory

                                                                                                                                                              jsxFactory?: string;
                                                                                                                                                              • Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'

                                                                                                                                                              property jsxFragmentFactory

                                                                                                                                                              jsxFragmentFactory?: string;
                                                                                                                                                              • Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.

                                                                                                                                                              property jsxImportSource

                                                                                                                                                              jsxImportSource?: string;
                                                                                                                                                              • Specify module specifier used to import the JSX factory functions when using jsx: react-jsx*.`

                                                                                                                                                              property keyofStringsOnly

                                                                                                                                                              keyofStringsOnly?: boolean;
                                                                                                                                                              • Make keyof only return strings instead of string, numbers or symbols. Legacy option.

                                                                                                                                                              property lib

                                                                                                                                                              lib?: Array<
                                                                                                                                                              | (
                                                                                                                                                              | 'ES5'
                                                                                                                                                              | 'ES6'
                                                                                                                                                              | 'ES2015'
                                                                                                                                                              | 'ES2015.Collection'
                                                                                                                                                              | 'ES2015.Core'
                                                                                                                                                              | 'ES2015.Generator'
                                                                                                                                                              | 'ES2015.Iterable'
                                                                                                                                                              | 'ES2015.Promise'
                                                                                                                                                              | 'ES2015.Proxy'
                                                                                                                                                              | 'ES2015.Reflect'
                                                                                                                                                              | 'ES2015.Symbol.WellKnown'
                                                                                                                                                              | 'ES2015.Symbol'
                                                                                                                                                              | 'ES2016'
                                                                                                                                                              | 'ES2016.Array.Include'
                                                                                                                                                              | 'ES2017'
                                                                                                                                                              | 'ES2017.Intl'
                                                                                                                                                              | 'ES2017.Object'
                                                                                                                                                              | 'ES2017.SharedMemory'
                                                                                                                                                              | 'ES2017.String'
                                                                                                                                                              | 'ES2017.TypedArrays'
                                                                                                                                                              | 'ES2018'
                                                                                                                                                              | 'ES2018.AsyncGenerator'
                                                                                                                                                              | 'ES2018.AsyncIterable'
                                                                                                                                                              | 'ES2018.Intl'
                                                                                                                                                              | 'ES2018.Promise'
                                                                                                                                                              | 'ES2018.Regexp'
                                                                                                                                                              | 'ES2019'
                                                                                                                                                              | 'ES2019.Array'
                                                                                                                                                              | 'ES2019.Object'
                                                                                                                                                              | 'ES2019.String'
                                                                                                                                                              | 'ES2019.Symbol'
                                                                                                                                                              | 'ES2020'
                                                                                                                                                              | 'ES2020.BigInt'
                                                                                                                                                              | 'ES2020.Promise'
                                                                                                                                                              | 'ES2020.String'
                                                                                                                                                              | 'ES2020.Symbol.WellKnown'
                                                                                                                                                              | 'ESNext'
                                                                                                                                                              | 'ESNext.Array'
                                                                                                                                                              | 'ESNext.AsyncIterable'
                                                                                                                                                              | 'ESNext.BigInt'
                                                                                                                                                              | 'ESNext.Intl'
                                                                                                                                                              | 'ESNext.Promise'
                                                                                                                                                              | 'ESNext.String'
                                                                                                                                                              | 'ESNext.Symbol'
                                                                                                                                                              | 'DOM'
                                                                                                                                                              | 'DOM.Iterable'
                                                                                                                                                              | 'ScriptHost'
                                                                                                                                                              | 'WebWorker'
                                                                                                                                                              | 'WebWorker.ImportScripts'
                                                                                                                                                              )
                                                                                                                                                              | string
                                                                                                                                                              >;
                                                                                                                                                              • Specify a set of bundled library declaration files that describe the target runtime environment.

                                                                                                                                                              property listEmittedFiles

                                                                                                                                                              listEmittedFiles?: boolean;
                                                                                                                                                              • Print the names of emitted files after a compilation.

                                                                                                                                                              property listFiles

                                                                                                                                                              listFiles?: boolean;
                                                                                                                                                              • Print all of the files read during the compilation.

                                                                                                                                                              property listFilesOnly

                                                                                                                                                              listFilesOnly?: boolean;
                                                                                                                                                              • Print names of files that are part of the compilation and then stop processing.

                                                                                                                                                              property mapRoot

                                                                                                                                                              mapRoot?: string;
                                                                                                                                                              • Specify the location where debugger should locate map files instead of generated locations.

                                                                                                                                                              property maxNodeModuleJsDepth

                                                                                                                                                              maxNodeModuleJsDepth?: number;
                                                                                                                                                              • Specify the maximum folder depth used for checking JavaScript files from node_modules. Only applicable with allowJs.

                                                                                                                                                              property module

                                                                                                                                                              module?:
                                                                                                                                                              | (
                                                                                                                                                              | 'CommonJS'
                                                                                                                                                              | 'AMD'
                                                                                                                                                              | 'System'
                                                                                                                                                              | 'UMD'
                                                                                                                                                              | 'ES6'
                                                                                                                                                              | 'ES2015'
                                                                                                                                                              | 'ES2020'
                                                                                                                                                              | 'ESNext'
                                                                                                                                                              | 'None'
                                                                                                                                                              )
                                                                                                                                                              | string;
                                                                                                                                                              • Specify what module code is generated.

                                                                                                                                                              property moduleResolution

                                                                                                                                                              moduleResolution?: ('Classic' | 'Node') | string;
                                                                                                                                                              • Specify how TypeScript looks up a file from a given module specifier.

                                                                                                                                                              property newLine

                                                                                                                                                              newLine?: ('crlf' | 'lf') | string;
                                                                                                                                                              • Set the newline character for emitting files.

                                                                                                                                                              property noEmit

                                                                                                                                                              noEmit?: boolean;
                                                                                                                                                              • Disable emitting file from a compilation.

                                                                                                                                                              property noEmitHelpers

                                                                                                                                                              noEmitHelpers?: boolean;
                                                                                                                                                              • Disable generating custom helper functions like __extends in compiled output.

                                                                                                                                                              property noEmitOnError

                                                                                                                                                              noEmitOnError?: boolean;
                                                                                                                                                              • Disable emitting files if any type checking errors are reported.

                                                                                                                                                              property noErrorTruncation

                                                                                                                                                              noErrorTruncation?: boolean;
                                                                                                                                                              • Disable truncating types in error messages.

                                                                                                                                                              property noFallthroughCasesInSwitch

                                                                                                                                                              noFallthroughCasesInSwitch?: boolean;
                                                                                                                                                              • Enable error reporting for fallthrough cases in switch statements.

                                                                                                                                                              property noImplicitAny

                                                                                                                                                              noImplicitAny?: boolean;
                                                                                                                                                              • Enable error reporting for expressions and declarations with an implied any type..

                                                                                                                                                              property noImplicitReturns

                                                                                                                                                              noImplicitReturns?: boolean;
                                                                                                                                                              • Enable error reporting for codepaths that do not explicitly return in a function.

                                                                                                                                                              property noImplicitThis

                                                                                                                                                              noImplicitThis?: boolean;
                                                                                                                                                              • Enable error reporting when this is given the type any.

                                                                                                                                                              property noImplicitUseStrict

                                                                                                                                                              noImplicitUseStrict?: boolean;
                                                                                                                                                              • Disable adding 'use strict' directives in emitted JavaScript files.

                                                                                                                                                              property noLib

                                                                                                                                                              noLib?: boolean;
                                                                                                                                                              • Disable including any library files, including the default lib.d.ts.

                                                                                                                                                              property noPropertyAccessFromIndexSignature

                                                                                                                                                              noPropertyAccessFromIndexSignature?: boolean;
                                                                                                                                                              • Enforces using indexed accessors for keys declared using an indexed type

                                                                                                                                                              property noResolve

                                                                                                                                                              noResolve?: boolean;
                                                                                                                                                              • Disallow imports, requires or <reference>s from expanding the number of files TypeScript should add to a project.

                                                                                                                                                              property noStrictGenericChecks

                                                                                                                                                              noStrictGenericChecks?: boolean;
                                                                                                                                                              • Disable strict checking of generic signatures in function types.

                                                                                                                                                              property noUncheckedIndexedAccess

                                                                                                                                                              noUncheckedIndexedAccess?: boolean;
                                                                                                                                                              • Add undefined to a type when accessed using an index.

                                                                                                                                                              property noUnusedLocals

                                                                                                                                                              noUnusedLocals?: boolean;
                                                                                                                                                              • Enable error reporting when a local variables aren't read.

                                                                                                                                                              property noUnusedParameters

                                                                                                                                                              noUnusedParameters?: boolean;
                                                                                                                                                              • Raise an error when a function parameter isn't read

                                                                                                                                                              property outDir

                                                                                                                                                              outDir?: string;
                                                                                                                                                              • Specify an output folder for all emitted files.

                                                                                                                                                              property outFile

                                                                                                                                                              outFile?: string;
                                                                                                                                                              • Specify a file that bundles all outputs into one JavaScript file. If declaration is true, also designates a file that bundles all .d.ts output.

                                                                                                                                                              property paths

                                                                                                                                                              paths?: {
                                                                                                                                                              [k: string]: string[];
                                                                                                                                                              };
                                                                                                                                                              • Specify a set of entries that re-map imports to additional lookup locations.

                                                                                                                                                              property plugins

                                                                                                                                                              plugins?: Array<{
                                                                                                                                                              /**
                                                                                                                                                              * Plugin name.
                                                                                                                                                              */
                                                                                                                                                              name?: string;
                                                                                                                                                              [k: string]: unknown;
                                                                                                                                                              }>;
                                                                                                                                                              • Specify a list of language service plugins to include.

                                                                                                                                                              property preserveConstEnums

                                                                                                                                                              preserveConstEnums?: boolean;
                                                                                                                                                              • Disable erasing const enum declarations in generated code.

                                                                                                                                                              preserveSymlinks?: boolean;
                                                                                                                                                              • Disable resolving symlinks to their realpath. This correlates to the same flag in node.

                                                                                                                                                              property preserveWatchOutput

                                                                                                                                                              preserveWatchOutput?: boolean;
                                                                                                                                                              • Disable wiping the console in watch mode

                                                                                                                                                              property pretty

                                                                                                                                                              pretty?: boolean;
                                                                                                                                                              • Enable color and formatting in output to make compiler errors easier to read

                                                                                                                                                              property reactNamespace

                                                                                                                                                              reactNamespace?: string;
                                                                                                                                                              • Specify the object invoked for createElement. This only applies when targeting react JSX emit.

                                                                                                                                                              property removeComments

                                                                                                                                                              removeComments?: boolean;
                                                                                                                                                              • Disable emitting comments.

                                                                                                                                                              property resolveJsonModule

                                                                                                                                                              resolveJsonModule?: boolean;
                                                                                                                                                              • Enable importing .json files

                                                                                                                                                              property rootDir

                                                                                                                                                              rootDir?: string;
                                                                                                                                                              • Specify the root folder within your source files.

                                                                                                                                                              property rootDirs

                                                                                                                                                              rootDirs?: string[];
                                                                                                                                                              • Allow multiple folders to be treated as one when resolving modules.

                                                                                                                                                              property skipDefaultLibCheck

                                                                                                                                                              skipDefaultLibCheck?: boolean;
                                                                                                                                                              • Skip type checking .d.ts files that are included with TypeScript.

                                                                                                                                                              property skipLibCheck

                                                                                                                                                              skipLibCheck?: boolean;
                                                                                                                                                              • Skip type checking all .d.ts files.

                                                                                                                                                              property sourceMap

                                                                                                                                                              sourceMap?: boolean;
                                                                                                                                                              • Create source map files for emitted JavaScript files.

                                                                                                                                                              property sourceRoot

                                                                                                                                                              sourceRoot?: string;
                                                                                                                                                              • Specify the root path for debuggers to find the reference source code.

                                                                                                                                                              property strict

                                                                                                                                                              strict?: boolean;
                                                                                                                                                              • Enable all strict type checking options.

                                                                                                                                                              property strictBindCallApply

                                                                                                                                                              strictBindCallApply?: boolean;
                                                                                                                                                              • Check that the arguments for bind, call, and apply methods match the original function.

                                                                                                                                                              property strictFunctionTypes

                                                                                                                                                              strictFunctionTypes?: boolean;
                                                                                                                                                              • When assigning functions, check to ensure parameters and the return values are subtype-compatible.

                                                                                                                                                              property strictNullChecks

                                                                                                                                                              strictNullChecks?: boolean;
                                                                                                                                                              • When type checking, take into account null and undefined.

                                                                                                                                                              property strictPropertyInitialization

                                                                                                                                                              strictPropertyInitialization?: boolean;
                                                                                                                                                              • Check for class properties that are declared but not set in the constructor.

                                                                                                                                                              property suppressExcessPropertyErrors

                                                                                                                                                              suppressExcessPropertyErrors?: boolean;
                                                                                                                                                              • Disable reporting of excess property errors during the creation of object literals.

                                                                                                                                                              property suppressImplicitAnyIndexErrors

                                                                                                                                                              suppressImplicitAnyIndexErrors?: boolean;
                                                                                                                                                              • Suppress noImplicitAny errors when indexing objects that lack index signatures.

                                                                                                                                                              property target

                                                                                                                                                              target?:
                                                                                                                                                              | (
                                                                                                                                                              | 'ES3'
                                                                                                                                                              | 'ES5'
                                                                                                                                                              | 'ES6'
                                                                                                                                                              | 'ES2015'
                                                                                                                                                              | 'ES2016'
                                                                                                                                                              | 'ES2017'
                                                                                                                                                              | 'ES2018'
                                                                                                                                                              | 'ES2019'
                                                                                                                                                              | 'ES2020'
                                                                                                                                                              | 'ESNext'
                                                                                                                                                              )
                                                                                                                                                              | string;
                                                                                                                                                              • Set the JavaScript language version for emitted JavaScript and include compatible library declarations.

                                                                                                                                                              property traceResolution

                                                                                                                                                              traceResolution?: boolean;
                                                                                                                                                              • Log paths used during the moduleResolution process.

                                                                                                                                                              property tsBuildInfoFile

                                                                                                                                                              tsBuildInfoFile?: string;
                                                                                                                                                              • Specify the folder for .tsbuildinfo incremental compilation files.

                                                                                                                                                              property typeRoots

                                                                                                                                                              typeRoots?: string[];
                                                                                                                                                              • Specify multiple folders that act like ./node_modules/@types.

                                                                                                                                                              property types

                                                                                                                                                              types?: string[];
                                                                                                                                                              • Specify type package names to be included without being referenced in a source file.

                                                                                                                                                              property useDefineForClassFields

                                                                                                                                                              useDefineForClassFields?: boolean;
                                                                                                                                                              • Emit ECMAScript-standard-compliant class fields.

                                                                                                                                                              property watch

                                                                                                                                                              watch?: boolean;
                                                                                                                                                              • Watch input files.

                                                                                                                                                              property watchDirectory

                                                                                                                                                              watchDirectory?:
                                                                                                                                                              | 'useFsEvents'
                                                                                                                                                              | 'fixedPollingInterval'
                                                                                                                                                              | 'dynamicPriorityPolling';
                                                                                                                                                              • Specify how directories are watched on systems that lack recursive file-watching functionality.

                                                                                                                                                              property watchFile

                                                                                                                                                              watchFile?:
                                                                                                                                                              | 'fixedPollingInterval'
                                                                                                                                                              | 'priorityPollingInterval'
                                                                                                                                                              | 'dynamicPriorityPolling'
                                                                                                                                                              | 'useFsEvents'
                                                                                                                                                              | 'useFsEventsOnParentDirectory';
                                                                                                                                                              • Specify how the TypeScript watch mode works.

                                                                                                                                                              index signature

                                                                                                                                                              [k: string]: unknown;

                                                                                                                                                                interface TransformOptionsTsJest

                                                                                                                                                                interface TransformOptionsTsJest<TransformerConfig = unknown>
                                                                                                                                                                extends TransformOptions<TransformerConfig> {}
                                                                                                                                                                • Deprecated

                                                                                                                                                                  use JestConfigWithTsJest instead

                                                                                                                                                                property config

                                                                                                                                                                config: Config.ProjectConfig;

                                                                                                                                                                  interface TsCompilerInstance

                                                                                                                                                                  interface TsCompilerInstance extends CompilerInstance {}

                                                                                                                                                                    property configSet

                                                                                                                                                                    configSet: ConfigSet;

                                                                                                                                                                      property program

                                                                                                                                                                      program: _ts.Program | undefined;

                                                                                                                                                                        interface TsJestAstTransformer

                                                                                                                                                                        interface TsJestAstTransformer {}

                                                                                                                                                                          property after

                                                                                                                                                                          after: AstTransformerDesc[];

                                                                                                                                                                            property afterDeclarations

                                                                                                                                                                            afterDeclarations: AstTransformerDesc[];

                                                                                                                                                                              property before

                                                                                                                                                                              before: AstTransformerDesc[];

                                                                                                                                                                                interface TsJestCompileOptions

                                                                                                                                                                                interface TsJestCompileOptions {}

                                                                                                                                                                                  property depGraphs

                                                                                                                                                                                  depGraphs: Map<string, DepGraphInfo>;

                                                                                                                                                                                    property supportsStaticESM

                                                                                                                                                                                    supportsStaticESM: boolean;

                                                                                                                                                                                      property watchMode

                                                                                                                                                                                      watchMode: boolean;

                                                                                                                                                                                        interface TsJestGlobalOptions

                                                                                                                                                                                        interface TsJestGlobalOptions {}
                                                                                                                                                                                        • Deprecated

                                                                                                                                                                                          use TsJestTransformerOptions instead

                                                                                                                                                                                        property astTransformers

                                                                                                                                                                                        astTransformers?: ConfigCustomTransformer;
                                                                                                                                                                                        • Custom transformers (mostly used by jest presets)

                                                                                                                                                                                        property babelConfig

                                                                                                                                                                                        babelConfig?: boolean | string | BabelConfig;
                                                                                                                                                                                        • Babel config. It can be: - false (or undefined, it's the default): do NOT use babel - true: use babel using default babelrc file - path/to/.babelrc: path to a babelrc file ( can be used) - {...}: an object with inline babel options

                                                                                                                                                                                          undefined does NOT use babel

                                                                                                                                                                                        property compiler

                                                                                                                                                                                        compiler?: 'typescript' | 'ttypescript' | string;
                                                                                                                                                                                        • Compiler to use

                                                                                                                                                                                          'typescript'

                                                                                                                                                                                        property diagnostics

                                                                                                                                                                                        diagnostics?:
                                                                                                                                                                                        | boolean
                                                                                                                                                                                        | {
                                                                                                                                                                                        /**
                                                                                                                                                                                        * Enables colorful and pretty output of errors
                                                                                                                                                                                        *
                                                                                                                                                                                        * @default undefined (enabled)
                                                                                                                                                                                        */
                                                                                                                                                                                        pretty?: boolean;
                                                                                                                                                                                        /**
                                                                                                                                                                                        * List of TypeScript diagnostic error codes to ignore
                                                                                                                                                                                        * [here](https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json).
                                                                                                                                                                                        *
                                                                                                                                                                                        * @see https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
                                                                                                                                                                                        * @default [6059,18002,18003]
                                                                                                                                                                                        */
                                                                                                                                                                                        ignoreCodes?: number | string | Array<number | string>;
                                                                                                                                                                                        /**
                                                                                                                                                                                        * If specified, diagnostics of source files which path **matches** will be ignored
                                                                                                                                                                                        */
                                                                                                                                                                                        exclude?: string[];
                                                                                                                                                                                        /**
                                                                                                                                                                                        * Logs TypeScript errors to stderr instead of throwing exceptions
                                                                                                                                                                                        *
                                                                                                                                                                                        * @default undefined (disabled)
                                                                                                                                                                                        */
                                                                                                                                                                                        warnOnly?: boolean;
                                                                                                                                                                                        };
                                                                                                                                                                                        • TS diagnostics - less to be reported if isolatedModules is true. It can be: - true (or undefined, it's the default): show all diagnostics - false: hide diagnostics of all files (kind of useless) - {...}: an inline object with fine grained settings

                                                                                                                                                                                          undefined shows all diagnostics

                                                                                                                                                                                        property isolatedModules

                                                                                                                                                                                        isolatedModules?: boolean;
                                                                                                                                                                                        • Compiles files as isolated modules (disables some features and type-checking)

                                                                                                                                                                                          undefined (disabled)

                                                                                                                                                                                        property stringifyContentPathRegex

                                                                                                                                                                                        stringifyContentPathRegex?: string | RegExp;
                                                                                                                                                                                        • Kept for backward compatibility to handle __TRANSFORM_HTML__ Any file which will match this regex will be transpiled as a module exporting the content of the file as a string

                                                                                                                                                                                        property tsconfig

                                                                                                                                                                                        tsconfig?: boolean | string | RawCompilerOptions;
                                                                                                                                                                                        • Compiler options. It can be: - true (or undefined, it's the default): use default tsconfig file - false: do NOT use default config file - path/to/tsconfig.json: path to a specific tsconfig file ( can be used) - {...}: an object with inline compiler options

                                                                                                                                                                                          undefined uses the default tsconfig file

                                                                                                                                                                                        property useESM

                                                                                                                                                                                        useESM?: boolean;
                                                                                                                                                                                        • Tell ts-jest to transform codes to ESM format. This only works in combination with jest-runtime ESM option supportsStaticESM true which is passed into Jest transformer

                                                                                                                                                                                        Type Aliases

                                                                                                                                                                                        type BabelConfig

                                                                                                                                                                                        type BabelConfig = _babel.TransformOptions;
                                                                                                                                                                                        • Don't mark as internal because it is used in TsJestGlobalOptions which is an exposed type

                                                                                                                                                                                        type StringMap

                                                                                                                                                                                        type StringMap = Map<string, string>;

                                                                                                                                                                                          type TsJestPresets

                                                                                                                                                                                          type TsJestPresets = Pick<
                                                                                                                                                                                          JestConfigWithTsJest,
                                                                                                                                                                                          'extensionsToTreatAsEsm' | 'moduleFileExtensions' | 'transform' | 'testMatch'
                                                                                                                                                                                          >;

                                                                                                                                                                                            type TsJestTransformerOptions

                                                                                                                                                                                            type TsJestTransformerOptions = TsJestGlobalOptions;

                                                                                                                                                                                              type TsJestTransformOptions

                                                                                                                                                                                              type TsJestTransformOptions = TransformOptions<TsJestTransformerOptions>;

                                                                                                                                                                                                type TTypeScript

                                                                                                                                                                                                type TTypeScript = typeof _ts;

                                                                                                                                                                                                  Package Files (13)

                                                                                                                                                                                                  Dependencies (8)

                                                                                                                                                                                                  Dev Dependencies (46)

                                                                                                                                                                                                  Peer Dependencies (5)

                                                                                                                                                                                                  Badge

                                                                                                                                                                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ts-jest.

                                                                                                                                                                                                  • Markdown
                                                                                                                                                                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ts-jest)
                                                                                                                                                                                                  • HTML
                                                                                                                                                                                                    <a href="https://www.jsdocs.io/package/ts-jest"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>