-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.js
48 lines (43 loc) · 1.16 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
const { env } = require('./.babelrc');
const alias = ((env.test.plugins.find(([name]) => name === 'babel-plugin-module-resolver') || [])[1] || {}).alias || {};
const moduleNameMapper = Object.keys(alias).reduce((accumulator, key) => ({
...accumulator,
[key]: (key.indexOf('$') >= 0 ? alias[key] : `${alias[key]}$1`).replace('./', '<rootDir>/'),
}), {});
const extensions = ['js', 'ts'];
const styleExtensions = ['css', 'scss'];
const applyExt = (prefix, exts = extensions) => exts.map((ext) => `${prefix}.${ext}`);
module.exports = {
collectCoverage: true,
collectCoverageFrom: [
...applyExt('src/app/**/*'),
'!src/app/**/*.d.ts',
],
coverageDirectory: 'coverage',
coverageReporters: [
'json',
'lcov',
],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
moduleFileExtensions: [
...extensions,
...styleExtensions,
],
moduleNameMapper,
setupFiles: [
'./src/testing/jest',
],
testRegex: '^.+\\.spec\\.(j|t)s$',
transform: {
'^.+\\.(j|t)s$': 'babel-jest',
'^.+\\.s?css$': 'jest-css-modules-transform',
},
transformIgnorePatterns: [],
};