Migrate test suite from Jest to Bun with web component testing#22
Merged
Migrate test suite from Jest to Bun with web component testing#22
Conversation
- Convert all unit tests from Jest to Bun syntax (mock(), expect(), etc.) - Add happy-dom for DOM testing capabilities with bunfig.toml configuration - Create separate web component tests in search-components.spec.js - Implement proper dependency injection for toggleDarkMode function - Fix event handler binding with arrow function wrapper - Add coverage/ directory to .gitignore - Update package.json with @happy-dom/global-registrator dependency All 100% test coverage maintained with improved performance and modern tooling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Keep all project files as JavaScript for consistency in a pure JS project. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Clean up after renaming to happydom.js. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use beforeAll instead of beforeEach for component registration - Remove guard clauses since we only register once - Clean up redundant comments that just restated obvious code - Keep meaningful comments that explain non-obvious behavior - Add comprehensive SettingOption component tests All 74 unit tests passing with 97% line coverage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Runs unit tests with lcov coverage reporter - Uses genhtml to generate browseable HTML coverage report - Outputs to coverage/html/index.html - Added to .PHONY declaration for proper make behavior Usage: make test-coverage-html 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The showSaveMessage() function became redundant after migrating to web components, since SaveMessage component handles its own visibility with the show() method. Removed: - showSaveMessage() function definition - showSaveMessage export - 2 unit tests (41 lines) with 5 test assertions - Import statement in test file Results: 72 tests passing, 97.25% line coverage maintained. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Reorder imports in search-components.spec.js alphabetically - Add proper spacing between test sections - Add trailing newline to test-results/.last-run.json - All Biome linting checks now pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
Complete migration from Jest to Bun test framework with added web component testing capabilities and improved code quality.
SaveMessage,SettingsDialog,SettingOption)showSaveMessage()function replaced by web componentsmake test-coverage-htmlcommand for browseable coverage reportsChanges Made
Test Framework Migration
mock(),expect(),describe(), etc.)DOM Testing Setup
@happy-dom/global-registratordependencybunfig.tomlandhappydom.jsfor DOM globals in testsWeb Component Tests
beforeAll()for clean component registration across all testsCode Cleanup
showSaveMessage()function (9 lines) and its tests (41 lines)toggleDarkModeparameter handling for better testabilityDeveloper Experience
make test-coverage-htmlgenerates browseable reports incoverage/html/Test Results
Migration Impact
🤖 Generated with Claude Code