-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
29 lines (26 loc) · 1016 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
const path = require("path")
const config = {
preset: "ts-jest",
transform: {
'^.+\\.tsx?$': ['ts-jest', {
// For most projects, the tsconfig.json and test/tsconfig.json are almost
// exactly the same. But it's more correct to point to test/tsconfig.json
// to prevent surprises in the future.
tsconfig: 'test/tsconfig.json'
}]
},
testMatch: ["**/test/**/*.[jt]s?(x)", "**/src/**/*.test.ts"],
testEnvironment: "node",
collectCoverage: true,
coveragePathIgnorePatterns: ["/node_modules/"],
testPathIgnorePatterns: ["/fixtures/", "/__fixtures__/", "<rootDir>/test/utils/.+"],
testTimeout: 4 * 60 * 1000, // 4 minutes
setupFilesAfterEnv: [path.join(__dirname, "jest.setup.js")],
maxWorkers: "50%",
}
if (process.env.PNPM_SCRIPT_SRC_DIR) {
const pathAsArr = process.env.PNPM_SCRIPT_SRC_DIR.split(path.sep)
const packageName = pathAsArr[pathAsArr.length - 1]
config.cacheDirectory = path.join(__dirname, ".jest-cache", packageName)
}
module.exports = config