-
Notifications
You must be signed in to change notification settings - Fork 16
/
jest.config.ts
55 lines (50 loc) · 1.85 KB
/
jest.config.ts
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
49
50
51
52
53
54
55
/// <reference lib="es2021" />
import {resolve} from 'node:path';
import {JestConfigWithTsJest, pathsToModuleNameMapper} from 'ts-jest';
process.env.TZ = 'Europe/Moscow';
process.env.FORCE_COLOR = 'true';
process.env.TS_JEST_DISABLE_VER_CHECKER = 'true';
const {compilerOptions} = require(resolve(__dirname, 'tsconfig.json'));
const maxParallel = require('node:os').cpus().length / 2;
const config: JestConfigWithTsJest = {
rootDir: __dirname,
preset: 'jest-preset-angular',
testEnvironment: 'jsdom',
extensionsToTreatAsEsm: ['.ts'],
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
tsconfig: resolve(__dirname, 'tsconfig.spec.json'),
stringifyContentPathRegex: '\\.html$',
isolatedModules: true,
diagnostics: true,
},
],
},
transformIgnorePatterns: [
'node_modules/(?!@angular|@ngx-translate|rxjs|@ngxs|ngx-mask)',
],
testMatch: ['<rootDir>/**/*.spec.ts'],
testPathIgnorePatterns: ['/node_modules/'],
coverageDirectory: '<rootDir>/coverage',
collectCoverageFrom: ['<rootDir>/libs/**/*.ts'],
coveragePathIgnorePatterns: ['node_modules', '.spec.ts', '.cy.ts'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: `<rootDir>/${compilerOptions.baseUrl}/`
.replaceAll('./', '/')
.replaceAll(/\/\/+/g, '/'),
}),
modulePathIgnorePatterns: ['.cache', 'dist', '<rootDir>/dist/'],
coverageReporters: ['lcov', 'clover'],
cacheDirectory: '<rootDir>/node_modules/.cache/jest',
maxConcurrency: maxParallel,
maxWorkers: maxParallel,
verbose: true,
bail: 1,
reporters: ['default'],
passWithNoTests: true,
collectCoverage: true,
};
export default config;