2021-12-04 16:28:52 +08:00
|
|
|
const { pathsToModuleNameMapper } = require('ts-jest/utils');
|
|
|
|
const { compilerOptions } = require('./tsconfig.jest.json');
|
2020-10-24 15:34:43 +08:00
|
|
|
|
|
|
|
module.exports = {
|
2021-12-06 21:23:34 +08:00
|
|
|
collectCoverage: true,
|
|
|
|
verbose: true,
|
|
|
|
testEnvironment: 'jsdom',
|
2020-10-24 15:34:43 +08:00
|
|
|
preset: 'ts-jest',
|
2021-12-06 21:23:34 +08:00
|
|
|
testMatch: ['**/__tests__/**/*.test.[jt]s?(x)'],
|
2021-05-23 08:38:08 +08:00
|
|
|
setupFilesAfterEnv: [
|
2021-12-06 21:23:34 +08:00
|
|
|
require.resolve('jest-dom/extend-expect'),
|
|
|
|
'./jest.setup.ts',
|
2020-10-24 15:34:43 +08:00
|
|
|
],
|
2021-12-04 16:28:52 +08:00
|
|
|
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
|
|
|
|
prefix: '<rootDir>/',
|
|
|
|
}),
|
2021-05-23 08:38:08 +08:00
|
|
|
globals: {
|
|
|
|
'ts-jest': {
|
2021-12-06 21:23:34 +08:00
|
|
|
babelConfig: false,
|
|
|
|
tsconfig: './tsconfig.jest.json',
|
2021-05-23 08:38:08 +08:00
|
|
|
diagnostics: false,
|
|
|
|
},
|
|
|
|
},
|
2021-12-06 21:23:34 +08:00
|
|
|
coveragePathIgnorePatterns: [
|
|
|
|
'/node_modules/',
|
|
|
|
'/__tests__/',
|
|
|
|
'/esm/',
|
|
|
|
'/lib/',
|
|
|
|
'package.json',
|
|
|
|
'/demo/',
|
|
|
|
'package-lock.json',
|
|
|
|
],
|
|
|
|
}
|