Files
proffesor-for-testing__agen…/jest.config.webapp.js
Profa f13eb30ce1 feat(edge): Phase 4 P2P integration with Edge Server
Phase 4 Implementation:
- SignalingServer: WebSocket server for WebRTC peer discovery
- AgentSpawnAPI: REST API for spawning QE agents from dashboard
- EdgeServer: Combined HTTP + WebSocket server entry point

CLI Enhancements:
- Added `aqe agent spawn <type>` command with task execution
- Added `aqe agent list` to view spawned agents
- Agent state persists to .agentic-qe/agents/ directory

P2PService Fixes (from brutal honesty review):
- Integrated real SignalingClient for WebRTC signaling
- Added RTCPeerConnection management with ICE handling
- Replaced mock connection with actual WebRTC setup
- Fixed PatternCategory enum mapping

Dashboard Fixes:
- Added error state display instead of silent failures
- Shows red error banner when agent spawn fails

Tests:
- AgentSpawnAPI.test.ts (17 tests)
- SignalingServer.test.ts (7 tests)
- Webapp component tests

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 13:06:48 +00:00

70 lines
1.7 KiB
JavaScript

/**
* Jest Configuration for Webapp Tests
*
* Separate configuration for React component and hook tests
* that require jsdom environment and React Testing Library.
*
* Usage:
* npm run test:webapp
* jest --config jest.config.webapp.js
*
* Dependencies (install if not present):
* npm install -D @testing-library/react @testing-library/jest-dom jest-environment-jsdom
*/
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
roots: ['<rootDir>/tests/edge/webapp', '<rootDir>/src/edge/webapp'],
testMatch: [
'**/tests/**/*.(test|spec).+(ts|tsx)',
],
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
tsconfig: {
jsx: 'react-jsx',
esModuleInterop: true,
skipLibCheck: true,
skipDefaultLibCheck: true,
},
isolatedModules: true,
}],
},
setupFilesAfterEnv: ['<rootDir>/tests/edge/webapp/setup.ts'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
// CSS modules mock
'\\.css$': 'identity-obj-proxy',
// Map .js imports to .ts source files
'^(\\.{1,2}/.*)\\.js$': '$1',
// Force P2PService to use mock - works for both relative and absolute imports
'^(.*/)?services/P2PService(\\.ts)?$': '<rootDir>/src/edge/webapp/services/__mocks__/P2PService.ts',
},
// Transform ESM modules
transformIgnorePatterns: [
'node_modules/(?!(uuid)/)',
],
// Test configuration
testTimeout: 10000,
// Don't auto-reset mocks as it breaks our mock implementations
clearMocks: false,
resetMocks: false,
restoreMocks: false,
// Coverage for webapp
collectCoverageFrom: [
'src/edge/webapp/**/*.{ts,tsx}',
'!src/edge/webapp/**/*.d.ts',
'!src/edge/webapp/**/index.ts',
],
// Reporter settings
reporters: ['default'],
};