-
Notifications
You must be signed in to change notification settings - Fork 12
/
jest.config.js
40 lines (37 loc) · 1.17 KB
/
jest.config.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
module.exports = () => {
const [NODE_MAJOR_VERSION] = process.versions.node.split('.').map(Number);
let collectCoverageFrom = [
'**/src/**/**/**/**.js',
'**/src/**/**/**/**.ts',
'!./src/tools/xmlToJson.js',
'!./src/testdata/functions/**/**.js',
'!./d_example/**/**',
];
let coverageThreshold = {
global: {
lines: 99.6,
},
};
if (NODE_MAJOR_VERSION < 18) {
// fetch is not supported in Node.js versions lower than 18,
// so no need to check coverage for that version
collectCoverageFrom.push('!./src/hooks/fetch.ts');
}
if (NODE_MAJOR_VERSION > 14) {
// Some of our unit tests don't work on Node.js grater than 14,
// so the coverage is lower when running with these versions
coverageThreshold.global.lines = 98.3;
}
return {
collectCoverage: true,
collectCoverageFrom: collectCoverageFrom,
coverageDirectory: './coverage/',
coverageThreshold: coverageThreshold,
modulePaths: ['<rootDir>/dist'],
roots: ['<rootDir>/src'],
setupFilesAfterEnv: ['./testUtils/jest.setup.js'],
globalSetup: './testUtils/prismaSetup.js',
silent: true,
watchPathIgnorePatterns: ['globalConfig'],
};
};