-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
131 lines (112 loc) · 2.57 KB
/
jest.config.js
File metadata and controls
131 lines (112 loc) · 2.57 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module.exports = {
// Test environment
testEnvironment: 'node',
// Root directory
rootDir: '.',
// Test directories
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{js,ts}',
'<rootDir>/src/**/*.{test,spec}.{js,ts}',
'<rootDir>/tests/**/*.{test,spec}.{js,ts}',
],
// Transform files
transform: {
'^.+\.ts$': 'ts-jest',
},
// Module file extensions
moduleFileExtensions: ['ts', 'js', 'json'],
// Module name mapping
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^@google/adk-javascript$': '<rootDir>/src/index.ts',
},
// Setup files
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
// Coverage configuration
collectCoverage: false,
collectCoverageFrom: [
'src/**/*.{ts,js}',
'!src/**/*.d.ts',
'!src/**/__tests__/**',
'!src/**/*.test.{ts,js}',
'!src/**/*.spec.{ts,js}',
'!src/index.ts', // Entry point, usually just exports
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html', 'json'],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
// Test timeout
testTimeout: 30000,
// Clear mocks
clearMocks: true,
restoreMocks: true,
// Verbose output
verbose: false,
// Error handling
errorOnDeprecated: true,
// Globals
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json',
isolatedModules: true,
},
},
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/build/',
'/lib/',
],
// Watch ignore patterns
watchPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/build/',
'/lib/',
'/coverage/',
],
// Module paths
modulePaths: ['<rootDir>/src'],
// Preset
preset: 'ts-jest',
// Test results processor
// testResultsProcessor: 'jest-sonar-reporter',
// Reporters
reporters: [
'default',
[
'jest-junit',
{
outputDirectory: 'test-results',
outputName: 'junit.xml',
suiteName: 'ADK JavaScript SDK Tests',
},
],
],
// Projects for multi-project setup (optional)
projects: [
{
displayName: 'unit',
testMatch: ['<rootDir>/src/**/__tests__/**/*.{test,spec}.{js,ts}'],
testEnvironment: 'node',
},
{
displayName: 'integration',
testMatch: ['<rootDir>/tests/**/*.{test,spec}.{js,ts}'],
testEnvironment: 'node',
},
{
displayName: 'e2e',
testMatch: ['<rootDir>/tests/e2e/**/*.{test,spec}.{js,ts}'],
testEnvironment: 'node',
},
],
};