Files
T
Dani 8e23f08d6d Add unit tests for StateCalculator, StateService, and WebSocketServer
- Implement comprehensive unit tests for StateCalculator to validate conversation status detection and state management.
- Create unit tests for StateService covering state management, subscriber notifications, and error handling.
- Develop unit tests for WebSocketServer to ensure proper handling of WebSocket connections, message broadcasting, and heartbeat mechanisms.
- Include edge case handling and validation for all components to enhance robustness and reliability.
2025-07-15 19:04:01 -04:00

84 lines
1.7 KiB
JavaScript

/**
* Jest Configuration for Claude Code Templates Analytics
* Phase 4: Testing & Optimization
*/
module.exports = {
// Test environment
testEnvironment: 'node',
// Test file patterns
testMatch: [
'**/tests/**/*.test.js',
'**/tests/**/*.spec.js',
'**/__tests__/**/*.js'
],
// Coverage configuration
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
collectCoverageFrom: [
'src/analytics/**/*.js',
'src/analytics-web/**/*.js',
'!src/analytics.log',
'!src/analytics-web/index.html*',
'!**/node_modules/**',
'!**/coverage/**'
],
// Coverage thresholds
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70
},
'./src/analytics/core/': {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
},
// Setup files
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
// Module paths
roots: ['<rootDir>/src', '<rootDir>/tests'],
// Transform files
transform: {},
// Test timeout
testTimeout: 10000,
// Verbose output
verbose: true,
// Clear mocks between tests
clearMocks: true,
// Restore mocks after each test
restoreMocks: true,
// Module name mapping for frontend tests
moduleNameMapping: {
'^@/(.*)$': '<rootDir>/src/analytics-web/$1',
'^@analytics/(.*)$': '<rootDir>/src/analytics/$1'
},
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
'/coverage/',
'/dist/'
],
// Watch plugins
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname'
]
};