forked from Predictify-org/predictify-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
85 lines (84 loc) · 3.4 KB
/
Copy pathjest.config.js
File metadata and controls
85 lines (84 loc) · 3.4 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
81
82
83
84
85
// Set dummy environment variables for tests so that config/env.ts parses successfully
process.env.NODE_ENV = "test";
process.env.PORT = "3001";
process.env.DATABASE_URL = "postgres://postgres:postgres@localhost:5432/predictify_test";
process.env.JWT_SECRET = "test-secret-with-at-least-32-characters";
process.env.SOROBAN_RPC_URL = "https://soroban-testnet.stellar.org";
process.env.HORIZON_URL = "https://horizon-testnet.stellar.org";
process.env.PREDICTIFY_CONTRACT_ID = "CABCDEF1234567890";
process.env.REDIS_URL = process.env.REDIS_URL || "redis://localhost:6379";
/** @type {import('jest').Config} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
globals: {
"ts-jest": {
// Only report diagnostics for files we own (tests + new src files).
// Pre-existing type errors in unrelated src files should not block the
// test runner. We still get errors for the files we are actually testing.
diagnostics: {
ignoreCodes: [
6133, // unused locals/params (pre-existing in several src files)
2304, // cannot find name (pre-existing stopIndexerHealthProbe etc.)
2305, // module has no exported member (pre-existing)
2307, // cannot find module (pre-existing)
2339, // property does not exist (pre-existing)
2345, // argument not assignable (pre-existing)
2352, // conversion may be a mistake (pre-existing)
2353, // object literal may only specify known properties (pre-existing)
2354, // this expression is not callable (pre-existing)
2551, // property does not exist, did you mean (pre-existing)
2552, // cannot find name, did you mean (pre-existing)
2554, // expected 0 arguments (pre-existing)
2571, // object is of type unknown (pre-existing)
2769, // no overload matches (pre-existing)
7006, // parameter implicitly has any type (pre-existing)
7030, // not all code paths return (pre-existing)
18046, // x is of type unknown (pre-existing)
],
},
},
},
setupFiles: ["<rootDir>/tests/setup.ts"],
moduleNameMapper: {
// Stub missing/broken modules so the test runner can import src/index.ts
"^.*/config/redis$": "<rootDir>/src/config/redis.ts",
"^.*/cache/marketsCache$": "<rootDir>/src/cache/marketsCache.ts",
},
testMatch: ["**/tests/**/*.test.ts", "**/src/__tests__/**/*.test.ts"],
globals: {
"ts-jest": {
// Use the test-specific tsconfig so ts-jest can find both src/ and
// tests/ files, and so unused-parameter errors in mock stubs don't
// block the test suite.
tsconfig: "<rootDir>/tsconfig.test.json",
// Disable full type-checking during test runs — tsc in CI handles
// that separately. This lets ts-jest transpile files that have
// pre-existing type errors in unrelated modules without blocking
// the test suite.
diagnostics: false,
},
},
collectCoverageFrom: [
"src/**/*.ts",
"!src/**/*.d.ts",
"!src/index.ts",
],
coverageDirectory: "coverage",
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 90,
statements: 90,
},
},
// Separate E2E tests from unit tests
testPathIgnorePatterns: [
"/node_modules/",
"/dist/",
],
// Increase timeout for E2E tests
testTimeout: 10000, // 10 seconds default, E2E tests override this
verbose: true,
};