2022-10-25 13:06:03 -07:00
|
|
|
const { compilerOptions } = require('./tsconfig.json');
|
|
|
|
|
2022-11-14 06:37:32 -08:00
|
|
|
const tsJestOptions = {
|
|
|
|
isolatedModules: true,
|
|
|
|
tsconfig: {
|
|
|
|
...compilerOptions,
|
|
|
|
declaration: false,
|
2023-01-24 17:18:39 -08:00
|
|
|
sourceMap: true,
|
2022-11-14 06:37:32 -08:00
|
|
|
skipLibCheck: true,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-10-25 13:06:03 -07:00
|
|
|
/** @type {import('jest').Config} */
|
2022-12-28 00:58:14 -08:00
|
|
|
const config = {
|
2022-10-25 13:06:03 -07:00
|
|
|
verbose: true,
|
|
|
|
testEnvironment: 'node',
|
|
|
|
testRegex: '\\.(test|spec)\\.(js|ts)$',
|
|
|
|
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
|
2022-11-14 06:37:32 -08:00
|
|
|
transform: {
|
|
|
|
'^.+\\.ts$': ['ts-jest', tsJestOptions],
|
2022-10-25 13:06:03 -07:00
|
|
|
},
|
2022-11-09 06:25:00 -08:00
|
|
|
moduleNameMapper: {
|
|
|
|
'^@/(.*)$': '<rootDir>/src/$1',
|
|
|
|
},
|
2023-03-10 07:53:05 -08:00
|
|
|
collectCoverage: true,
|
|
|
|
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
|
|
|
|
collectCoverageFrom: ['src/**/*.ts'],
|
2022-10-25 13:06:03 -07:00
|
|
|
};
|
2022-12-28 00:58:14 -08:00
|
|
|
|
|
|
|
if (process.env.CI === 'true') {
|
|
|
|
config.maxWorkers = 2;
|
|
|
|
config.workerIdleMemoryLimit = 2048;
|
2023-03-10 07:53:05 -08:00
|
|
|
config.coverageReporters = ['cobertura'];
|
2022-12-28 00:58:14 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = config;
|