forked from lukaswelinder/react-router
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest-preset.js
30 lines (29 loc) · 813 Bytes
/
jest-preset.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
function resolveName(packageName) {
switch (process.env.TEST_ENV) {
case "cjs":
return `<rootDir>/../${packageName}/cjs/${packageName}.js`;
case "umd":
return `<rootDir>/../${packageName}/umd/${packageName}.js`;
case "module":
default:
return `<rootDir>/../${packageName}/modules/index.js`;
}
}
module.exports = {
testRunner: "jest-circus/runner",
restoreMocks: true,
globals: {
__DEV__: true
},
moduleNameMapper: {
"^react-router$": resolveName("react-router"),
"^react-router-config$": resolveName("react-router-config"),
"^react-router-dom$": resolveName("react-router-dom")
},
setupFiles: ["raf/polyfill"],
testMatch: ["**/__tests__/**/*-test.js"],
transform: {
"^.+\\.[jt]sx?$": "babel-jest"
},
testURL: "http://localhost/"
};