-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathjest.config.js
More file actions
91 lines (89 loc) · 3.22 KB
/
Copy pathjest.config.js
File metadata and controls
91 lines (89 loc) · 3.22 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
86
87
88
89
90
91
/** @type {import('jest').Config} */
const sharedAliases = {
'^@/(.*)$': '<rootDir>/apps/server/src/$1',
'^@core/(.*)$': '<rootDir>/apps/server/src/core/$1',
'^@config/(.*)$': '<rootDir>/apps/server/src/config/$1',
'^@routes/(.*)$': '<rootDir>/apps/server/src/routes/$1',
'^@models/(.*)$': '<rootDir>/apps/server/src/models/$1',
'^@middleware/(.*)$': '<rootDir>/apps/server/src/middleware/$1',
'^@services/(.*)$': '<rootDir>/apps/server/src/services/$1',
'^@utils/(.*)$': '<rootDir>/apps/server/src/utils/$1',
'^@types/(.*)$': '<rootDir>/apps/server/src/types/$1',
'^@constants/(.*)$': '<rootDir>/apps/server/src/constants/$1',
'^@codesoul-co/hypha-([^/]+)$': '<rootDir>/packages/$1/src',
'^@codesoul-co/hypha-([^/]+)/(.*)$': '<rootDir>/packages/$1/src/$2',
};
// ts-jest transforms .ts. The MCP SDK ships as ESM; let ts-jest also process
// its .js so `import {...}` parses inside Jest's CJS runtime.
const transform = {
'^.+\\.(t|j)sx?$': [
'ts-jest',
{ tsconfig: '<rootDir>/tsconfig.jest.json' },
],
};
const transformIgnorePatterns = ['/node_modules/(?!@modelcontextprotocol)/'];
module.exports = {
// Run unit + integration as separate Jest projects so they can have
// different setup files (unit mocks the DB layer; integration hits real
// Mongo + Redis on localhost).
projects: [
{
displayName: 'unit',
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['<rootDir>/apps/server/src/**/*.test.ts', '<rootDir>/tests/unit/**/*.test.ts'],
moduleNameMapper: sharedAliases,
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
transform,
transformIgnorePatterns,
},
{
displayName: 'integration',
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['<rootDir>/tests/integration/**/*.test.ts'],
testPathIgnorePatterns: [
'<rootDir>/tests/integration/memory-external-providers.integration.test.ts',
'<rootDir>/tests/integration/memory-native-production-topology.integration.test.ts',
],
moduleNameMapper: sharedAliases,
setupFilesAfterEnv: ['<rootDir>/tests/integration/setup.ts'],
transform,
transformIgnorePatterns,
},
{
displayName: 'memory-external-acceptance',
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: [
'<rootDir>/tests/integration/memory-external-providers.integration.test.ts',
],
moduleNameMapper: sharedAliases,
setupFilesAfterEnv: ['<rootDir>/tests/integration/setup.ts'],
transform,
transformIgnorePatterns,
},
{
displayName: 'memory-native-acceptance',
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: [
'<rootDir>/tests/integration/memory-native-production-topology.integration.test.ts',
],
moduleNameMapper: sharedAliases,
setupFilesAfterEnv: ['<rootDir>/tests/integration/setup.ts'],
transform,
transformIgnorePatterns,
},
],
// testTimeout lives in each project's setup file via jest.setTimeout().
collectCoverageFrom: [
'apps/**/*.ts',
'packages/**/*.ts',
'!apps/**/*.d.ts',
'!packages/**/*.d.ts',
'!**/index.ts',
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
};