Add visual regression testing with ink-visual-testing #408
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
Implements visual regression testing using ink-visual-testing to automatically detect UI changes and prevent visual regressions.
Changes
π§ Setup
ink-visual-testingpackage (v1.0.1).ink-visual.config.jswith terminal size presets.gitignoreto exclude temporary test outputsπ§ͺ Test Infrastructure
tests/visual/*.tsx)src/ui.visual.test.tsxwith 6 test scenariosπ Test Coverage
Game States:
Multi-board Games:
Initial State:
Terminal Sizes: 80Γ24, 120Γ30, 160Γ35
π NPM Scripts
πΈ Baseline Images
Generated 6 PNG baselines (136KB total):
midgame.png(17KB) - Shows game in progress with colored letter hintswin.png(18KB) - Shows "You win!" with all green letterslose.png(25KB) - Shows failure message with correct worddual-board.png(21KB) - Two game boards side by sidetriple-board.png(27KB) - Three game boardsfresh-start.png(14KB) - Clean game boardπ Documentation
VISUAL_TESTING.mdguide with:Test Results
All tests passing with 0 pixel difference:
Technical Details
Uses file path mode instead of component mode:
tests/visual/exitPlease: trueBenefits
β¨ Prevents visual regressions - Automatically detects unintended UI changes
π Easy review - Visual diffs show exactly what changed
β‘ Fast feedback - Runs in ~18 seconds
π¦ CI-ready - Can be integrated into CI/CD pipelines
π― Comprehensive - Covers all game states and layouts
Test Plan
π€ Generated with ai ,my english is so pool.