2023-07-26 17:53:51 +08:00
|
|
|
const { pathsToModuleNameMapper } = require('ts-jest');
|
2023-09-15 08:51:20 +08:00
|
|
|
const { compilerOptions } = require('./tsconfig.paths.json');
|
2020-10-24 15:34:43 +08:00
|
|
|
|
2023-10-17 22:22:45 +08:00
|
|
|
const swcrc = {
|
|
|
|
jsc: {
|
|
|
|
parser: {
|
|
|
|
syntax: 'typescript',
|
|
|
|
tsx: false,
|
|
|
|
decorators: true,
|
|
|
|
dynamicImport: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
((swcrc.jsc ??= {}).experimental ??= {}).plugins = [['jest_workaround', {}]];
|
|
|
|
|
|
|
|
const config = {
|
2022-05-19 00:40:55 +08:00
|
|
|
rootDir: process.cwd(),
|
2021-12-07 19:40:30 +08:00
|
|
|
collectCoverage: false,
|
2021-12-06 21:23:34 +08:00
|
|
|
verbose: true,
|
2020-10-24 15:34:43 +08:00
|
|
|
preset: 'ts-jest',
|
2023-05-25 10:40:08 +08:00
|
|
|
testMatch: ['**/__tests__/**/*.test.[jt]s'],
|
2023-04-10 08:48:26 +08:00
|
|
|
setupFiles: ['./jest.setup.ts'],
|
2023-07-26 17:53:51 +08:00
|
|
|
setupFilesAfterEnv: ['./jest.setupAfterEnv.ts'],
|
2023-05-21 17:18:35 +08:00
|
|
|
moduleNameMapper: {
|
|
|
|
...pathsToModuleNameMapper(compilerOptions.paths, {
|
|
|
|
prefix: '<rootDir>/',
|
|
|
|
}),
|
|
|
|
},
|
2023-07-26 17:53:51 +08:00
|
|
|
transform: {
|
2023-10-17 22:22:45 +08:00
|
|
|
'^.+\\.(t|j)sx?$': ['@swc/jest', swcrc],
|
2021-05-23 08:38:08 +08:00
|
|
|
},
|
2023-05-25 10:40:08 +08:00
|
|
|
modulePathIgnorePatterns: ['/esm/', '/es/', '/dist/', '/lib/', '/client/', '/sdk/', '\\.test\\.tsx$'],
|
2021-12-06 21:23:34 +08:00
|
|
|
coveragePathIgnorePatterns: [
|
|
|
|
'/node_modules/',
|
|
|
|
'/__tests__/',
|
|
|
|
'/esm/',
|
|
|
|
'/lib/',
|
|
|
|
'package.json',
|
|
|
|
'/demo/',
|
|
|
|
'package-lock.json',
|
2023-09-12 22:39:23 +08:00
|
|
|
'/storage/',
|
2021-12-06 21:23:34 +08:00
|
|
|
],
|
2022-02-15 11:02:56 +08:00
|
|
|
};
|
2023-10-17 22:22:45 +08:00
|
|
|
|
|
|
|
module.exports = config;
|