forked from tokopedia/treats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
42 lines (38 loc) · 1.18 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
const path = require("path"),
TREATS_ALIAS = require("./packages/treats/alias");
const resolver = Object.keys(TREATS_ALIAS).reduce((result, key) => {
result[`^${key}(.*)$`] = `${TREATS_ALIAS[key]}$1`;
return result;
}, {});
let coverageThreshold;
if (process.env.TEST_ENV !== "lint-staged") {
coverageThreshold = {
global: {
branches: 2,
functions: 2,
lines: 2,
statements: 2
}
};
}
module.exports = {
verbose: true,
testURL: "http://localhost/",
setupFiles: [path.join(__dirname, "./jestsetup.js")],
globals: {
NODE_ENV: "test"
},
snapshotSerializers: ["enzyme-to-json/serializer"],
moduleFileExtensions: ["js", "jsx", "json"],
moduleNameMapper: {
"^.+\\.(css|scss)$": "identity-obj-proxy",
...resolver
},
testPathIgnorePatterns: ["node_modules/", "generator/"],
coveragePathIgnorePatterns: ["node_modules/", "generator/"],
collectCoverage: true,
collectCoverageFrom: ["<rootDir>/**/*.{js}", "!<rootDir>/**/*.stories.js"],
coveragePathIgnorePatterns: ["node_modules/", "generator/"],
coverageReporters: ["html"],
coverageThreshold
};