generated from Tinkoff/angular-open-source-starter
-
Notifications
You must be signed in to change notification settings - Fork 7
/
jest.config.ts
61 lines (56 loc) · 1.99 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
56
57
58
59
60
61
import {resolve} from 'node:path';
import type {Config} from 'jest';
import {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: Config = {
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: String.raw`\.html$`,
isolatedModules: true,
diagnostics: true,
},
],
},
transformIgnorePatterns: [
String.raw`node_modules/(?!@angular|rxjs|ngx-highlightjs|@maskito|@ng-web-apis|@taiga-ui)`,
],
testMatch: ['<rootDir>/projects/**/*.spec.ts'],
testPathIgnorePatterns: ['/demo-playwright/', '/node_modules/', '/schematics/'],
coverageDirectory: '<rootDir>/coverage',
collectCoverageFrom: ['<rootDir>/projects/**/*.ts'],
coveragePathIgnorePatterns: [
'node_modules',
'schematics',
'load-assets.ts',
'.spec.ts',
'.cy.ts',
],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: `<rootDir>/${compilerOptions.baseUrl}/`
.replaceAll('./', '/')
.replaceAll(/\/\/+/g, '/'),
}),
modulePathIgnorePatterns: ['.cache', 'dist', '<rootDir>/dist/'],
coverageReporters: ['text', 'lcov', 'clover'],
cacheDirectory: '<rootDir>/node_modules/.cache/jest',
maxConcurrency: maxParallel,
maxWorkers: maxParallel,
verbose: false,
bail: 1,
reporters: ['default'],
passWithNoTests: true,
collectCoverage: true,
};
export default config;