forked from stitchesjs/stitches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.base.js
36 lines (33 loc) · 960 Bytes
/
jest.config.base.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
const semver = require("semver");
function getSupportedTypescriptTarget() {
const nodeVersion = process.versions.node;
if (semver.gt(nodeVersion, "10.0.0")) {
return "es2018";
} else if (semver.gt(nodeVersion, "7.6.0")) {
return "es2017";
} else if (semver.gt(nodeVersion, "7.0.0")) {
return "es2016";
} else if (semver.gt(nodeVersion, "6.0.0")) {
return "es2015";
} else {
return "es5";
}
}
module.exports = {
roots: ["<rootDir>/src", "<rootDir>/tests"],
testURL: "http://localhost",
preset: "ts-jest",
testRegex: "(/tests/.*.(test|spec)).(jsx?|tsx?)$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
collectCoverageFrom: ["src/**/*.{t,j}s?(x)", "!src/**/*.d.ts"],
collectCoverage: true,
coveragePathIgnorePatterns: ["(tests/.*.mock).(jsx?|tsx?)$"],
verbose: true,
globals: {
"ts-jest": {
tsConfig: {
target: getSupportedTypescriptTarget(),
},
},
},
};