-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.js
60 lines (56 loc) · 1.57 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
const path = require("path");
const FULL_TEST = Boolean(process.env.FULL_TEST);
// jest.config.js
const { defaults } = require('jest-config');
const CONSOLE_FAIL_TYPES = ['error', 'warn'];
const ENABLE_COVERAGE = !!process.env.CI;
// Throw errors when a `console.error` or `console.warn` happens
/* by overriding the functions
CONSOLE_FAIL_TYPES.forEach((type) => {
console[type] = (message) => {
throw new VError.errorFromList(
`Failing due to console.${type} while running test!\n\n${message}`,
);
};
});
*/
module.exports = {
collectCoverage: FULL_TEST,
collectCoverageFrom: [
'__tests__/**/*.js',
'!scripts/**/*.js',
'!scripts/generateIndexes.js',
'src/**/*.js',
'!<rootDir>/node_modules/',
'!src/prettier-comments/**/*.js',
],
coverageReporters: ['clover', 'json', 'lcov'],
coverageDirectory: './coverage/',
coveragePathIgnorePatterns: ['/node_modules/', '/scripts/'],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
setupFiles: ['<rootDir>/tests/config/setup.js'],
snapshotFormat: {
escapeString: false,
printBasicPrototype: false,
},
snapshotSerializers: [
'jest-snapshot-serializer-raw',
'jest-snapshot-serializer-ansi',
],
testTimeout: 12500,
testEnvironment: 'node',
coverageReporters: ["text", "lcov"],
testRegex: 'jsfmt\\.spec\\.js$|tests/unit/.*\\.js$',
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
};