Files
proffesor-for-testing__agen…/jest.config.js
Profa 11dfbcbf35 chore(release): bump version to v2.4.0
## Added
- Binary Metadata Cache with 6x faster pattern loading
- AI-Friendly Output Mode with structured JSON output
- Automated Benchmarks in CI with regression detection
- Strategy-Based Agent Architecture foundation (36% BaseAgent reduction)

## Fixed
- ExecutionEvent interface mismatch in BaseAgent learning hooks
- AgentStateData missing timestamp in saveState
- Deprecated direct agentDB access in FlakyTestHunter, TestExecutor, TestGenerator
- AdapterConfigValidator tests using validateOrThrow()
- QXPartnerAgent tests using correct store/retrieve methods
- FleetCommanderAgent lifecycle test expecting IDLE after init

## Tests
- 425 new tests for performance infrastructure
- Strategy pattern tests: 92 passing
- Agent tests: 166 passing
- Adapter fail-fast tests: 17 passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 11:09:49 +00:00

148 lines
4.6 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// CRITICAL: Set NODE_ENV before any modules load
// This ensures AdapterConfig correctly detects test environment
process.env.NODE_ENV = 'test';
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
// CRITICAL: Global setup/teardown to prevent process.cwd() errors
globalSetup: '<rootDir>/jest.global-setup.ts',
globalTeardown: '<rootDir>/jest.global-teardown.ts',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/*.(test|spec).+(ts|tsx|js)'
],
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
tsconfig: {
skipLibCheck: true,
skipDefaultLibCheck: true
},
isolatedModules: true
}]
},
// CRITICAL: Coverage configuration - enabled via --coverage flag
collectCoverage: false, // Set to true via CLI --coverage flag
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.test.ts',
'!src/**/__mocks__/**',
'!src/**/types/**',
'!src/**/index.ts'
],
coverageDirectory: 'coverage',
coverageReporters: [
'text',
'lcov',
'html',
'json-summary'
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts', '<rootDir>/tests/setup.ts'],
testEnvironmentOptions: {
// Use dynamic cwd - process.cwd() at config load time is stable
cwd: process.cwd()
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^@core/(.*)$': '<rootDir>/src/core/$1',
'^@agents/(.*)$': '<rootDir>/src/agents/$1',
'^@cli/(.*)$': '<rootDir>/src/cli/$1',
'^@utils/(.*)$': '<rootDir>/src/utils/$1',
'^@types$': '<rootDir>/src/types/index.ts',
'^@types/(.*)$': '<rootDir>/src/types/$1',
'^@mcp/(.*)$': '<rootDir>/src/mcp/$1',
'^@learning/(.*)$': '<rootDir>/src/learning/$1',
'^@reasoning/(.*)$': '<rootDir>/src/reasoning/$1',
'^@streaming/(.*)$': '<rootDir>/src/streaming/$1',
'^@routing/(.*)$': '<rootDir>/src/core/routing/$1',
'^@memory/(.*)$': '<rootDir>/src/memory/$1',
// Mock agentdb ESM module to avoid "Unexpected token 'export'" errors
'^agentdb$': '<rootDir>/__mocks__/agentdb.ts',
// Map .js imports to .ts source files for Jest
'^(\\.{1,2}/.*)\\.js$': '$1'
},
// Memory optimization settings - Enhanced for DevPod
maxWorkers: 1, // Reduced from 2 to 1 for maximum safety
workerIdleMemoryLimit: '384MB', // More aggressive: 512MB → 384MB
testTimeout: 30000, // Increased: 15s → 20s for better cleanup time
cache: true, // Enable caching to reduce compilation overhead
cacheDirectory: '/tmp/jest-cache', // Explicit cache location
maxConcurrency: 2, // Limit concurrent test suites
bail: false, // Continue on test failures to complete cleanup
clearMocks: true, // Auto-clear mocks between tests
resetMocks: true, // Reset mock state between tests
restoreMocks: true, // Restore original implementations
// Advanced leak detection - Balanced approach
detectLeaks: false, // Disabled - too aggressive for integration tests
detectOpenHandles: true, // Find unclosed resources
forceExit: false, // Allow graceful exit
// Transform faker-js/faker, uuid, and agentdb ESM modules
transformIgnorePatterns: [
'node_modules/(?!(@faker-js|inquirer|cli-cursor|cli-spinners|ora|chalk|strip-ansi|ansi-regex|is-fullwidth-code-point|string-width|wrap-ansi|cliui|uuid|agentdb)/)'
],
// Module handling - reduce loading overhead
modulePathIgnorePatterns: [
'<rootDir>/dist/',
'<rootDir>/coverage/',
'<rootDir>/node_modules/.cache/'
],
// Test path ignoring to reduce discovery overhead
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/coverage/',
'\\.skip\\.(test|spec)\\.(ts|js)$'
],
// Custom reporters for memory tracking
reporters: [
'default',
['<rootDir>/tests/utils/memory-reporter.js', {
enabled: process.env.TRACK_MEMORY === 'true'
}],
// JUnit reporter for CI integration (generates junit.xml)
['jest-junit', {
outputDirectory: '.',
outputName: 'junit.xml',
classNameTemplate: '{classname}',
titleTemplate: '{title}',
ancestorSeparator: ' › ',
usePathForSuiteName: true
}]
],
// Force garbage collection between test files
testSequencer: '<rootDir>/tests/sequencers/MemorySafeSequencer.js',
// Coverage thresholds - Migration targets
coverageThreshold: {
global: {
branches: 75,
functions: 80,
lines: 80,
statements: 80
},
// Critical path coverage (higher threshold)
'./src/core/': {
branches: 85,
functions: 85,
lines: 85,
statements: 85
},
'./src/agents/': {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
}
};