-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
45 lines (41 loc) · 1.14 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
const tsconfig = require('./tsconfig.json');
const fromPairs = pairs => pairs.reduce((res, [key, value]) => ({ ...res, [key]: value }), {});
const createJestModuleMapsForTesting = () => {
return fromPairs(
Object.entries(tsconfig.compilerOptions.paths).map(([k, [v]]) => [
`^${k.replace(/\*/, '(.*)')}`,
`<rootDir>/src/${v.replace(/\*/, '$1')}`,
]),
);
};
const moduleNameMapper = createJestModuleMapsForTesting();
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/test'],
globals: {
'ts-jest': {
tsConfig: 'tsconfig.test.json',
diagnostics: false,
},
},
verbose: true,
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__test__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper,
collectCoverageFrom: [
'!**/node_modules/**',
'!**/vendor/**',
'!**/migrations/**',
'!**/exceptions/**',
'!**/coverage/**',
'!**/seed/**',
'!**/database/**',
'!**/graphql/**',
'!**/test/**',
'**/*.{js,jsx,ts, tsx}',
],
coverageDirectory: './coverage/',
};