-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
37 lines (35 loc) · 972 Bytes
/
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
const fromPairs = pairs => pairs.reduce((res, [key, value]) => ({
...res,
[key]: value
}), {})
function moduleNameMapperFromTSPaths(tsconfig) {
return fromPairs(
Object.entries(tsconfig.compilerOptions.paths).map(([k, [v]]) => [
`^${k.replace(/\*/, "(.*)")}`,
`<rootDir>/${v.replace(/\*/, "$1")}`,
]),
)
}
const tsconfig = require("./tsconfig.json")
const moduleNameMapper = moduleNameMapperFromTSPaths(tsconfig)
module.exports = {
preset: 'jest-puppeteer',
testEnvironment: 'jest-environment-puppeteer',
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/dist/',
'<rootDir>/test/fixtures',
],
coveragePathIgnorePatterns: [
'<rootDir>/test/',
],
setupFilesAfterEnv: [
'<rootDir>/jest.setup.ts'
],
reporters: [ 'default' ],
transform: {
'^.+\\.(t|j)s$': '@swc/jest',
},
verbose: false,
moduleNameMapper
};