-
Notifications
You must be signed in to change notification settings - Fork 82
/
jest.preset.js
86 lines (85 loc) · 2.32 KB
/
jest.preset.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const nxPreset = require('@nx/jest/preset').default;
module.exports = {
...nxPreset,
verbose: true,
rootDir: './',
roots: ['<rootDir>'],
prettierPath: 'prettier',
coverageDirectory: '<rootDir>/reports/coverage',
coverageReporters: [['lcov', { projectRoot: '/' }], 'text', 'text-summary', 'clover', 'html'],
reporters: [
'default',
[
'jest-sonar',
{
outputDirectory: '<rootDir>/reports/sonar',
outputName: 'results-report.xml',
reportedFilePath: 'absolute',
relativeRootDir: './',
},
],
[
'jest-junit',
{
suiteName: 'Unit tests',
outputDirectory: '<rootDir>/reports/junit',
outputName: './results-report.xml',
usePathForSuiteName: 'true',
},
],
],
transform: {
'^.+\\.(js|mjs|cjs|ts|html)?$': [
'ts-jest',
{
diagnostics: false,
isolatedModules: true,
sourceMap: true,
inlineSourceMap: true,
tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
},
transformIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/reports/'],
testMatch: [
'<rootDir>/__tests__/**/*.(spec|test).(j|t)s?(x)',
'<rootDir>/src/**/*.(spec|test).(j|t)s?(x)',
],
testPathIgnorePatterns: ['__mocks__', '__fixtures__'],
collectCoverageFrom: [
'<rootDir>/src/**/*.{js,ts}',
'!<rootDir>/**/types.ts',
'!<rootDir>/**/*.d.*',
'!<rootDir>/**/*.test.js',
'!<rootDir>/**/test/*.js',
],
coveragePathIgnorePatterns: [
'\\\\node_modules\\\\',
'<rootDir>/jest/',
'<rootDir>/node_modules/',
'\\\\dist\\\\',
'\\\\__tests__\\\\',
],
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
testEnvironmentOptions: {
...nxPreset.testEnvironmentOptions,
url: 'https://www.test-host.com',
runScripts: 'dangerously',
resources: 'usable',
},
setupFilesAfterEnv: ['../../jest/jest.setup-dom.js'],
setupFiles: ['core-js', 'jest-date-mock', '../../jest/jest.polyfills.js'],
testEnvironment: '../../jest/jsdom-extended.js',
testRunner: 'jest-circus/runner',
cacheDirectory: '../../node_modules/.cache/unit-tests',
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
clearMocks: true,
globalSetup: '../../jest/jest.global-setup.js',
};