-
Notifications
You must be signed in to change notification settings - Fork 277
Expand file tree
/
Copy pathjest.config.js
More file actions
80 lines (80 loc) · 2.59 KB
/
Copy pathjest.config.js
File metadata and controls
80 lines (80 loc) · 2.59 KB
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
71
72
73
74
75
76
77
78
79
80
module.exports = {
// Run two project configs in one pass:
// 1. "backend" — all existing TypeScript tests, node environment
// 2. "frontend" — JS calculator tests, jsdom environment
projects: [
{
displayName: "backend",
preset: "ts-jest",
testEnvironment: "node",
setupFiles: ["<rootDir>/tests/jest.setup.ts"],
roots: ["<rootDir>/src", "<rootDir>/tests"],
testMatch: ["**/__tests__/**/*.ts", "**/?(*.)+(spec|test).ts"],
// Exclude frontend JS, Playwright E2E, and Pact tests from backend Jest run
testPathIgnorePatterns: [
"/node_modules/",
"<rootDir>/src/tests/frontend/",
"<rootDir>/tests/e2e/",
"<rootDir>/tests/pact/",
],
transform: {
"^.+\\.[jt]sx?$": ["ts-jest", { diagnostics: false }],
},
transformIgnorePatterns: [
"node_modules/(?!(@stellar|@noble|@exodus|uint8array-extras)/)",
],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
// Mirrors the (otherwise-dead, since `projects` doesn't inherit
// top-level options) mapper below — lets `jest.mock("../foo.js")`
// resolve to the real "../foo.ts" source file.
moduleNameMapper: {
"^(\\.\\.?\\/.+)\\.js$": "$1",
},
},
{
displayName: "frontend",
testEnvironment: "jsdom",
setupFiles: ["<rootDir>/tests/jest.setup.ts"],
roots: ["<rootDir>/src/tests/frontend"],
testMatch: ["**/?(*.)+(spec|test).js"],
transform: {
"^.+\\.[jt]s$": ["ts-jest", { diagnostics: false }],
},
moduleFileExtensions: ["js", "ts", "json", "node"],
},
],
// Coverage collected from both projects
preset: "ts-jest",
testEnvironment: "node",
setupFilesAfterEnv: ["<rootDir>/tests/jest.setup.ts"],
roots: ["<rootDir>/src", "<rootDir>/tests"],
testMatch: ["**/__tests__/**/*.ts", "**/?(*.)+(spec|test).ts"],
testPathIgnorePatterns: ["/node_modules/", "/tests/pact/", "/tests/e2e/"],
testTimeout: 30000,
moduleNameMapper: {
"^(\\.\\.?\\/.+)\\.js$": "$1",
},
transform: {
"^.+\\.ts$": ["ts-jest", { diagnostics: false }],
},
collectCoverageFrom: [
"src/**/*.ts",
"src/tests/frontend/**/*.js",
"!src/**/*.d.ts",
"!src/index.ts",
"!src/**/__tests__/**",
"!src/services/providerSettlementService.ts",
],
coverageDirectory: "coverage",
coverageReporters: ["text", "text-summary", "lcov", "html", "json-summary"],
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
verbose: true,
maxWorkers: "50%",
};