-
Notifications
You must be signed in to change notification settings - Fork 60
/
jest.config.ts
60 lines (58 loc) · 1.7 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
import fs from "fs"
import type { Config } from "@jest/types"
const libs: any = fs
.readdirSync("./libs", { withFileTypes: true })
.filter((directory) => directory.isDirectory())
.map(({ name }) => ({
displayName: name,
rootDir: `libs/${name}/src`,
testRegex: ".*\\.test\\.ts$",
moduleNameMapper: {
"@bandada/(.*)": "<rootDir>/../../$1/src/index.ts"
},
moduleFileExtensions: ["js", "ts", "json"],
transform: {
"^.+\\.(t|j)s$": "ts-jest"
}
}))
export default async (): Promise<Config.InitialOptions> => ({
projects: [
...libs,
{
displayName: "api",
rootDir: "apps/api/src",
testRegex: ".*\\.test\\.ts$",
moduleNameMapper: {
"@bandada/(.*)": "<rootDir>/../../../libs/$1/src/index.ts"
},
moduleFileExtensions: ["js", "ts", "json"],
transform: {
"^.+\\.(t|j)s$": "ts-jest"
},
setupFiles: ["dotenv/config"]
}
],
verbose: true,
coverageReporters: ["lcov", "html"],
coverageDirectory: "./coverage/jest",
collectCoverageFrom: [
"<rootDir>/**/*.ts",
"!<rootDir>/**/main.ts",
"!<rootDir>/**/docSchemas/**.ts",
"!<rootDir>/**/*.module.ts",
"!<rootDir>/**/*.controller.ts",
"!<rootDir>/**/*.dto.ts",
"!<rootDir>/**/*.entity.ts",
"!<rootDir>/**/*.strategy.ts",
"!<rootDir>/**/index.ts",
"!<rootDir>/**/*.d.ts"
],
coverageThreshold: {
global: {
branches: 90,
functions: 95,
lines: 95,
statements: 95
}
}
})