Set up proper test suite with Jest#11
Merged
GhostTypes merged 6 commits intoNov 21, 2025
Merged
Conversation
- Removed legacy src/test.ts manual integration test - Configured Jest with ts-jest for TypeScript support - Added test:coverage npm script with coverage thresholds - Excluded coverage directory from git Test Coverage (157 tests passing): - NetworkUtils: 100% coverage - Temperature utility: 100% coverage - ScientificNotationFloatConverter: 100% coverage - All TCP replay parsers: 93-100% coverage - PrinterInfo (M115 response parsing) - TempInfo (M105 response parsing) - PrintStatus (M27 response parsing) - EndstopStatus (M119 response parsing) - LocationInfo (M114 response parsing) - ThumbnailInfo (M662 PNG data parsing) - Filament class: 100% coverage - Info control module: Complete API test coverage - Files control module: Existing test coverage maintained Overall coverage: 32% (branches: 44%, functions: 24%, lines: 33%) Coverage thresholds: 30% statements, 30% lines, 20% functions, 40% branches All tests passing. Foundation set for continued test expansion.
Added 64 new tests for printer control API modules, achieving "easy wins" coverage improvements as planned. Test Coverage (221 tests passing, +64 from previous 157): Control Module Coverage (src/api/controls): - Control.ts: 93% statements, 95% branches, 100% functions - Tests for homing, filtration, camera, LED, fans, speed/offset - Tests for filament operations and runout sensor - Comprehensive sendControlCommand testing - TempControl.ts: 100% coverage across all metrics - Tests for extruder and bed temperature control - Tests for temperature cancellation - Tests for part cooling wait functionality - JobControl.ts: 46% statements, 52% branches, 79% functions - Tests for pause/resume/cancel operations - Tests for AD5X multi-color and single-color jobs - Comprehensive material mapping validation tests - Tests for printLocalFile with firmware version logic - Info.ts: 96% statements, 96% branches, 100% functions - Files.ts: 63% (maintained existing coverage) Overall api/controls module: 63% statements, 70% branches, 91% functions Project-wide coverage improvement: - Overall: 32% → 44% (+12%) - Branches: 44% → 52% (+8%) - Functions: 24% → 42% (+18%) - Lines: 33% → 45% (+12%) All tests passing. Strong foundation for continued development.
Added comprehensive CI workflow that: - Runs automatically on pull requests to main/master - Can be manually triggered from Actions tab - Tests against Node.js 18.x and 20.x for compatibility - Runs full test suite with coverage reporting - Enforces coverage thresholds (30% statements, 20% functions) - Uploads coverage artifacts for review - Displays coverage summary in workflow output Workflow triggers on changes to: - Source files (src/**) - Package configuration (package.json, tsconfig.json) - Workflow file itself Features: - Uses npm ci for reproducible builds - Caches node_modules for faster runs - Matrix strategy for multi-version testing - Coverage report artifact retention (7 days) - Clear pass/fail status reporting This ensures all future PRs are automatically validated for quality.
Changed workflow to: - Pass CI when all tests pass (not dependent on coverage thresholds) - Generate coverage report for informational purposes only - Upload coverage artifact even if thresholds not met - Display coverage summary but don't fail build on it This ensures PRs can be merged when tests pass, while still providing coverage visibility for code quality monitoring.
Removed coverage report generation and artifacts to focus on test validation. Coverage can still be run locally with 'npm run test:coverage'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.