How to use ts-jest

Comprehensive ts-jest code examples:

How to use ts-jest.pathsToModuleNameMapper:

13
14
15
16
17
18
19
20
21
22
23
24


const tsConfig = resolve(__dirname, 'tsconfig.json')
const { compilerOptions } = parseJSON(
  readFileSync(tsConfig, { encoding: 'utf8' })
)
const pathsToModuleNames = pathsToModuleNameMapper(compilerOptions.paths, {
  prefix: `${__dirname}/`
})


const moduleNameMapper = MAP_PATHS_TO_MODULES ? pathsToModuleNames : undefined