forked from leather-io/extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
executable file
·40 lines (38 loc) · 1.12 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
const { version } = require('./package.json');
const { compilerOptions } = require('./tsconfig');
const pathNames = {};
Object.keys(compilerOptions.paths).forEach(key => {
const [path] = compilerOptions.paths[key];
if (key.includes('/ui')) {
return;
}
if (path.startsWith('../')) {
pathNames[key] = `<rootDir>/${path.slice(3)}`;
return;
} else {
pathNames[key.replace(/\*/g, '(.*)')] = `<rootDir>/src/${path.replace(/\*/g, '$1')}`;
}
});
module.exports = {
collectCoverage: true,
coverageReporters: ['html', 'json-summary'],
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
globals: {
'ts-jest': {
// https://huafu.github.io/ts-jest/user/config/diagnostics
diagnostics: false,
tsconfig: '<rootDir>/tests/tsconfig.json',
},
VERSION: version,
},
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node', 'd.ts'],
moduleNameMapper: pathNames,
roots: ['<rootDir>/tests', '<rootDir>/src'],
preset: 'ts-jest',
testRegex: '/tests/.*.test.tsx?$',
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.jsx?$': 'babel-jest',
'^.+\\.tsx?$': 'ts-jest',
},
};