Current test coverage for the mcpmon project as of latest run:
=============================== Coverage summary ===============================
Statements : 58.96% ( 332/563 )
Branches : 36.62% ( 63/172 )
Functions : 58.49% ( 62/106 )
Lines : 59.96% ( 325/542 )
================================================================================
- Total Test Suites: 8
- Total Tests: 65 (all passing)
- Test Categories:
- Behavioral tests: 27 tests
- Integration tests: 30 tests
- Error scenario tests: 8 tests
-
proxy.ts - Core proxy implementation
- ~62% line coverage
- Message buffering, restart logic, file watching
- Process lifecycle management
-
CLI Integration - Command-line interface
- Comprehensive integration tests
- Auto-detection for Node.js, Python, Deno
- Environment variable handling
- Error scenarios
-
Node Implementations - Platform-specific code
- NodeFileSystem: File operations and watching
- NodeProcessManager: Process spawning and management
- Spawn error handling via status promise
-
Error Handling Paths
- Server initialization failures ✓
- Process crash recovery ✓
- Stream forwarding errors ✓
- Request timeouts ✓
-
Configuration
- Basic configuration handling
- Environment variable processing
-
cli.ts - Main CLI entry point (0%)
- Tested indirectly through integration tests
- Direct unit tests would improve coverage
-
index.ts - Library exports (0%)
- Simple export file
- Used by library consumers
-
interfaces.ts - Type definitions (0%)
- Pure TypeScript interfaces
- Dead code removed (isProcessManager, isFileSystem)
- proxy_restart.test.ts - File change triggers restart
- message_buffering.test.ts - Messages queued during restart
- initialization_replay.test.ts - Initialize params preserved
- error_handling.test.ts - Various error scenarios
- error_scenarios.test.ts - Additional error paths
- generic_interfaces.test.ts - Interface compatibility
- cli.test.ts - Full CLI functionality
- Help display
- Watch file auto-detection
- Environment variables
- Process management
- Signal handling
- node_implementations.test.ts - Real file I/O and process operations
- File watching with multiple files
- Process spawning with various configurations
- Stream handling
- Error propagation
- Fixed all test failures - All 65 tests now pass reliably
- Added comprehensive error scenario tests - Improved error path coverage
- Fixed timer cleanup - Resolved Jest worker exit warnings
- Fixed spawn error handling - Async errors now properly propagated
- Added CLI integration tests - Real-world usage scenarios
- Added Node implementation tests - Platform-specific functionality
- Add unit tests for cli.ts - Would significantly boost coverage
- Test edge cases:
- Very large files/directories
- Symbolic links
- Permission errors
- Network file systems
- Performance tests:
- Stress testing with many file changes
- Memory usage over time
- Large message handling
- Cross-platform testing:
- Windows-specific path handling
- Different Node.js versions
✅ Comprehensive behavioral testing - Core functionality thoroughly tested ✅ Real integration tests - Actual process spawning and file I/O ✅ Error scenario coverage - Many error paths now tested ✅ Clean test architecture - Good use of mocks and helpers ✅ Deterministic timing - No flaky setTimeout-based tests