-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathjest.config.js
More file actions
60 lines (59 loc) · 2.08 KB
/
Copy pathjest.config.js
File metadata and controls
60 lines (59 loc) · 2.08 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
// 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",
transform: {
"^.+\\.tsx?$": [
"ts-jest",
{
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,
},
],
},
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"],
collectCoverageFrom: [
"src/**/*.ts",
"!src/**/*.d.ts",
"!src/index.ts",
],
coverageDirectory: "coverage",
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 90,
statements: 90,
},
},
// Separate E2E and Testcontainers-backed integration tests from unit tests.
// Integration tests need the Postgres container started by
// jest.integration.config.js — run them with `npm run test:integration`.
testPathIgnorePatterns: [
"/node_modules/",
"/dist/",
"/tests/integration/",
],
// Increase timeout for E2E tests
testTimeout: 10000, // 10 seconds default, E2E tests override this
verbose: true,
};