-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.base.js
35 lines (32 loc) · 1.06 KB
/
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
const { basename } = require("path");
const merge = require("merge");
const tsPreset = require("ts-jest/presets/js-with-babel/jest-preset");
module.exports = ({ path }, presets = []) => {
const name = basename(path);
// Enables us to run tests of only a specific type (for example "integration" or "e2e").
let type = "";
if (process.env.TEST_TYPE) {
type = `.${process.env.TEST_TYPE}`;
}
return merge.recursive({}, tsPreset, ...presets, {
name: name,
displayName: name,
modulePaths: [`${path}/src`],
testMatch: [`${path}/**/__tests__/**/*${type}.test.[jt]s?(x)`],
transform: {
"^.+\\.(ts|tsx)$": "ts-jest"
},
moduleNameMapper: {
"~/(.*)": `${path}/src/$1`
},
moduleDirectories: ["node_modules"],
moduleFileExtensions: ["ts", "js", "tsx"],
modulePathIgnorePatterns: [],
globals: {
"ts-jest": {
babelConfig: `${path}/.babelrc.js`,
diagnostics: false
}
}
});
};