-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
61 lines (56 loc) · 2.06 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
61
process.env.TZ = 'UTC';
const PACKAGES_PATH = {
components: '<rootDir>/src/components',
core: '<rootDir>/src/core',
};
const JS = '{js,jsx,ts,tsx}';
const GENERAL_IGNORE = [`**/index.${JS}`, `**/typings/*.${JS}`];
// temporarily ignore the following folders from testing to get a starting point that includes code coverage
// every sprint iteration should remove some of these entries until we can remove this variable alltogether!
// @TODO remove variable ASAP
const TMP_IGNORE = [
`${PACKAGES_PATH.components}/actions/**/*.${JS}`,
`${PACKAGES_PATH.components}/containers/**/*.${JS}`,
`${PACKAGES_PATH.components}/data/**/*.${JS}`,
`${PACKAGES_PATH.components}/fields/**/*.${JS}`,
`${PACKAGES_PATH.components}/layouts/**/*.${JS}`,
`${PACKAGES_PATH.components}/miscellaneous/**/*.${JS}`,
`${PACKAGES_PATH.components}/pickers/**/*.${JS}`,
`${PACKAGES_PATH.components}/popups/**/*.${JS}`,
`${PACKAGES_PATH.components}/text/**/*.${JS}`,
`${PACKAGES_PATH.components}/utils/**/*.${JS}`,
`${PACKAGES_PATH.core}/formats/format.${JS}`,
`${PACKAGES_PATH.core}/formats/number.${JS}`,
`${PACKAGES_PATH.core}/utilities/**/*.${JS}`,
];
module.exports = {
roots: Object.values(PACKAGES_PATH),
collectCoverageFrom: [
...Object.values(PACKAGES_PATH).map(path => `${path}/**/*.${JS}`),
...GENERAL_IGNORE.map(ignore => `!${ignore}`),
...TMP_IGNORE.map(ignore => `!${ignore}`), // @TODO: remove ASAP
],
coverageThreshold: {
global: {
statements: 75,
branches: 75,
functions: 75,
lines: 75,
},
},
coverageReporters: ['text', 'cobertura'],
moduleDirectories: ['node_modules', 'src'],
moduleNameMapper: {
'^@dots/core$': PACKAGES_PATH.core,
'^@dots/components$': PACKAGES_PATH.components,
},
globals: {
'ts-jest': {
babelConfig: true,
},
},
preset: 'ts-jest/presets/js-with-babel',
testRegex: '(__)?tests(__)?/.*\\.test\\.[jt]sx?$',
setupFiles: ['<rootDir>/src/components/__mocks__/globals/index.js'],
reporters: ['default', ['jest-junit', { outputDirectory: './reports', outputName: 'tests.xml' }]],
};