-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjest.config.js
38 lines (35 loc) · 907 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
38
const { pathsToModuleNameMapper } = require("ts-jest")
const {
readConfigFile,
parseJsonConfigFileContent,
sys,
} = require("typescript")
const configFile = readConfigFile("./tsconfig.json", sys.readFile)
if (typeof configFile.error !== "undefined") {
throw new Error(`Failed to load tsconfig: ${configFile.error}`)
}
const { options } = parseJsonConfigFileContent(
configFile.config,
{
fileExists: sys.fileExists,
readFile: sys.readFile,
readDirectory: sys.readDirectory,
useCaseSensitiveFileNames: true,
},
__dirname
)
module.exports = {
roots: ["<rootDir>"],
testMatch: ["**/?(*.)+(test).+(ts)"],
globals: {
"ts-jest": {
tsconfig: "tsconfig.test.json",
},
},
transform: {
"^.+\\.(t|j)s$": "esbuild-jest" /* Replace with ts-jest as needed */,
},
moduleNameMapper: pathsToModuleNameMapper(options.paths, {
prefix: "<rootDir>",
}),
}