-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjest.config.js
More file actions
28 lines (26 loc) · 710 Bytes
/
Copy pathjest.config.js
File metadata and controls
28 lines (26 loc) · 710 Bytes
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
import tsconfig from './tsconfig.json' with { type: 'json' };
const { compilerOptions: { paths } } = tsconfig;
const reg = /(.*)\/\*/;
const aliases = Object.keys(paths).reduce(
(obj, a) => {
if (reg.test(a)) {
obj[`^${a.replace(reg, '$1')}/(.*)$`] = `<rootDir>/${paths[a][0].replace(reg, '$1')}/$1`;
} else {
obj[`^${a}$`] = `<rootDir>/${paths[a][0]}`;
}
return obj;
},
{}
);
export default {
roots: ['<rootDir>/tests'],
moduleNameMapper: aliases,
transform: {
'^.+\\.ts$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js'],
collectCoverageFrom: [
'src/**/*.ts'
],
testEnvironment: 'jsdom'
};