-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.base.js
48 lines (44 loc) · 1.39 KB
/
jest.config.base.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 path = require('path');
const cwd = process.cwd();
const folder = path.basename(cwd);
const parent = path.basename(path.dirname(cwd));
// eslint-disable-next-line import/no-dynamic-require
const { name } = require(`${cwd}/package.json`);
const rootDir = path.resolve(__dirname);
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
rootDir,
displayName: name,
verbose: true,
clearMocks: true,
forceExit: true,
preset: 'ts-jest',
transform: {
'^.+\\.ts?$': 'ts-jest',
},
testEnvironment: 'node',
testMatch: [`<rootDir>/${parent}/${folder}/**/*.spec.ts`, `<rootDir>/${parent}/${folder}/**/*.spec.js`],
coverageDirectory: path.join(cwd, 'coverage'),
coverageReporters: ['json', 'lcov', 'text', 'clover'],
collectCoverage: process.argv.indexOf('--coverage') > 0,
collectCoverageFrom: [
`<rootDir>/${parent}/${folder}/src/*.ts`,
`<rootDir>/${parent}/${folder}/src/**/*.ts`,
`<rootDir>/${parent}/${folder}/src/*.js`,
`<rootDir>/${parent}/${folder}/src/**/*.js`,
`!<rootDir>/${parent}/${folder}/**/*.spec.ts`,
'!**/gen/**',
'!**/coverage/**',
'!**/node_modules/**',
'!apps/**',
'!examples/**',
'!tools/**',
'!scripts/**',
'!jest.config.base.js',
'!jest.config.js',
'!babel.config.js',
'!webpack.config.js',
'!eslintrc.js',
],
};