fix: resolve failing frontend tests and test environment issues - #193
Open
zinodict121 wants to merge 2 commits into
Open
fix: resolve failing frontend tests and test environment issues#193zinodict121 wants to merge 2 commits into
zinodict121 wants to merge 2 commits into
Conversation
# Conflicts: # src/components/ui/VirtualList.tsx # src/hooks/useVirtualList.ts # tests/hooks/useVirtualList.test.ts
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.
Fix Failing Frontend Tests and Test Environment Issues
Description
This PR resolves several critical test suite failures in the frontend utility project, ensuring that the test environment is fully stable across platforms and that there are no infinite layout loops during component tests.
Closes #181
Changes Made
#!/usr/bin/env node) fromscripts/pre-commit.mjs. Vite's strict ES Module parser (Rolldown) was choking on it when imported intests/unit/preCommit.test.ts.ENOENTerrors inscripts/setup-dev.tsby appending{ shell: process.platform === "win32" }toexecFileSync("npm", ...). This ensures.cmdscripts are resolved properly on Windows.VirtualList: Fixed theMaximum update depth exceedederror insrc/components/ui/VirtualList.tsx. ThecreateMeasureReffactory was previously returning a new function reference every render, creating a detachment/attachment loop. It now uses a stableuseRefdictionary. Additionally,useVirtualList.tsnow safely ignores 0-height measurements (common in jsdom) to prevent layout thrashing.tests/hooks/useVirtualList.test.ts.windowscrolling by supplyinguseContainerScroll: false.handleScrollto prevent synchronous test mocks from unintentionally locking therequestAnimationFramequeue reference.node:child_processintests/unit/setupDev.test.tsto prevent the unit test from timing out while attempting to run actual npm scripts.Verification
npm run test).Type of change