-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathjest.base.config.ts
37 lines (36 loc) · 1.07 KB
/
jest.base.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
import type { Config } from 'jest';
export function getConfig(type: string, name: string): Config {
const root = type.split('/').length === 2 ? '../../../' : '../../';
return {
collectCoverage: true,
coverageDirectory: `${root}test-reports/${type}/${name}/coverage`,
coveragePathIgnorePatterns: ['<rootDir>/src/lib/testing'],
coverageReporters: ['html', 'lcov', 'json', 'text-summary'],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
displayName: name,
globals: {
'ts-jest': {
isolatedModules: true,
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
preset: `${root}jest.preset.js`,
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
transformIgnorePatterns: [
'node_modules/(?!(.*\\.(mjs|esm.js)$|swiper/.*$))',
],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
}