-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathjest.base.config.ts
More file actions
48 lines (46 loc) · 1.66 KB
/
jest.base.config.ts
File metadata and controls
48 lines (46 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const path = require('path');
const packagesDir = path.join(__dirname, 'packages');
const config = (coverageDir?: string) => ({
preset: 'ts-jest',
roots: ['<rootDir>'],
rootDir: '.',
moduleFileExtensions: ['js', 'json', 'ts'],
testRegex: '.(spec|test).ts$',
transform: {
'^.+\\.(t|j)s$': [
'ts-jest',
{
isolatedModules: true,
tsconfig: path.join(__dirname, 'tsconfig.test.json'),
},
] as any,
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
'^@suites/core.unit(.*)$': path.join(packagesDir, 'core/src$1'),
'^@suites/types.common(.*)$': path.join(packagesDir, 'types/common/src$1'),
'^@suites/types.di(.*)$': path.join(packagesDir, 'types/di/src$1'),
'^@suites/types.doubles(.*)$': path.join(packagesDir, 'types/doubles/src$1'),
'^@suites/di.nestjs(.*)$': path.join(packagesDir, 'di/nestjs/src$1'),
'^@suites/di.inversify(.*)$': path.join(packagesDir, 'di/inversify/src$1'),
'^@suites/doubles.jest(.*)$': path.join(packagesDir, 'doubles/jest/src$1'),
'^@suites/doubles.sinon(.*)$': path.join(packagesDir, 'doubles/sinon/src$1'),
'^@suites/doubles.vitest(.*)$': path.join(packagesDir, 'doubles/vitest/src$1'),
},
coveragePathIgnorePatterns: ['/node_modules/', 'spec-assets.ts', '/__test__/'],
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
testEnvironment: 'node',
coverageDirectory: coverageDir || '<rootDir>',
coverageReporters: [
'text',
[
'cobertura',
{
file: process.env.COVERAGE_FILE || 'coverage-report.xml',
},
],
] as any,
reporters: ['default', 'jest-junit'],
testResultsProcessor: 'jest-junit',
});
export default config;