You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
920 B
27 lines
920 B
5 years ago
|
const { pathsToModuleNameMapper } = require('ts-jest/utils');
|
||
|
// In the following statement, replace `./tsconfig` with the path to your `tsconfig` file
|
||
|
// which contains the path mapping (ie the `compilerOptions.paths` option):
|
||
|
const { jsonc } = require('jsonc');
|
||
|
const { readFileSync } = require('fs');
|
||
|
|
||
|
const { compilerOptions } = jsonc.parse(readFileSync('./tsconfig.json', { encoding: 'utf8' }));
|
||
|
|
||
|
module.exports = {
|
||
|
transform: {
|
||
|
'^.+\\.tsx?$': 'ts-jest',
|
||
|
},
|
||
|
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
|
||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
||
|
testEnvironment: './config/jest.environment.js',
|
||
|
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
|
||
|
prefix: '<rootDir>',
|
||
|
}),
|
||
|
globals: {
|
||
|
'ts-jest': {
|
||
|
diagnostics: {
|
||
|
ignoreCodes: ['TS151001'],
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
};
|