mirror of
https://github.com/MichMich/MagicMirror.git
synced 2026-04-23 06:17:53 +00:00
This PR improves `clientonly` start option with better code structure, validation, and comprehensive test coverage. ### Changes **Refactoring:** - Improved parameter handling with explicit function parameter passing instead of closure - Added port validation (1-65535) with proper NaN handling - Removed unnecessary IIFE wrapper (Node.js modules are already scoped) - Extracted `getCommandLineParameter` as a reusable top-level function - Enhanced error reporting with better error messages - Added connection logging for debugging **Testing:** - Added comprehensive e2e tests for parameter validation - Test coverage for missing/incomplete parameters - Test coverage for local address rejection (localhost, 127.0.0.1, ::1, ::ffff:127.0.0.1) - Test coverage for port validation (invalid ranges, non-numeric values) - Test coverage for TLS flag parsing - Integration test with running server ### Testing All tests pass: ```bash npm test -- tests/e2e/clientonly_spec.js # ✓ 18 tests passed