-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
70 lines (64 loc) · 1.75 KB
/
jest.config.ts
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import os from "os";
import { JestConfigWithTsJest, pathsToModuleNameMapper } from "ts-jest";
import tsconfig from "./tsconfig.json";
const maxThreads = os.cpus().length;
const maxWorkers = process.env.MAXIMIZE_THREADS ? maxThreads : maxThreads / 2;
let baseOptions: JestConfigWithTsJest = {
automock: false,
cache: false,
clearMocks: false,
detectLeaks: false,
detectOpenHandles: false,
errorOnDeprecated: false,
extensionsToTreatAsEsm: [".ts"],
forceExit: true,
logHeapUsage: false,
maxWorkers,
// testRunner: "jest-jasmine2",
moduleFileExtensions: ["js", "ts", "json", "node"],
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths),
modulePaths: [tsconfig.compilerOptions.baseUrl],
resetModules: false,
setupFiles: ["./configs/jest/jest.setup.ts"],
setupFilesAfterEnv: ["./configs/jest/setupFileAfterEnv.ts"],
silent: false,
skipNodeResolution: false,
testEnvironment: "node",
testMatch: ["**/testSrc/**/*.spec.ts"],
testPathIgnorePatterns: [
"<rootDir>/node_modules/",
"<rootDir>/lib",
"<rootDir>/coverage",
"<rootDir>/.history",
],
// testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.ts?$",
testTimeout: 20000,
transform: {
"^.+\\.ts?$": [
"ts-jest",
{
diagnostics: {
// exclude: ["**"],
},
useESM: true,
},
],
},
transformIgnorePatterns: [
"<rootDir>/node_modules/",
"<rootDir>/lib",
"<rootDir>/coverage",
],
verbose: true,
};
const coverageOptions: JestConfigWithTsJest = {
collectCoverage: true,
collectCoverageFrom: ["./src/**"],
coverageThreshold: {
global: {
lines: 85,
},
},
};
if (process.env.COVERAGE) baseOptions = { ...baseOptions, ...coverageOptions };
export default baseOptions;