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