forked from mobxjs/mobx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.base.config.js
27 lines (25 loc) · 960 Bytes
/
jest.base.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
const fs = require("fs")
const path = require("path")
const tsConfig = "tsconfig.test.json"
module.exports = function buildConfig(packageDirectory, pkgConfig) {
const packageName = require(`${packageDirectory}/package.json`).name
const packageTsconfig = path.resolve(packageDirectory, tsConfig)
return {
preset: "ts-jest/presets/js-with-ts",
testEnvironment: "jest-environment-jsdom-fifteen",
globals: {
__DEV__: true,
"ts-jest": {
tsconfig: fs.existsSync(packageTsconfig)
? packageTsconfig
: path.resolve(__dirname, tsConfig)
}
},
testRegex: "__tests__/.*\\.(j|t)sx?$",
coverageDirectory: "<rootDir>/coverage/",
coverageReporters: ["lcov", "text"],
collectCoverageFrom: ["<rootDir>/src/**/*.{ts,tsx}", "!**/node_modules/**"],
displayName: packageName,
...pkgConfig
}
}