-
-
Notifications
You must be signed in to change notification settings - Fork 757
fix(test): flaky test due to calling toJSON while hot updating #12694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rspack canceled.
|
📦 Binary Size-limit
🙈 Size remains the same at 47.88MB |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a flaky E2E test that was causing panics due to a race condition between page reload and HMR connection during compilation. The test was attempting to call stats.toJSON() while the module graph was being updated during hot module replacement, resulting in a panic.
Changes:
- Added
runtimeChunk: 'single'optimization to ensure HMR uses a single runtime chunk - Removed manual
page.reload()call and replaced with direct HMR-based assertion to eliminate the race condition
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/e2e/cases/make/remove-dynamic-entry-with-loader/rspack.config.js | Added runtimeChunk: 'single' optimization to enable proper HMR handling |
| tests/e2e/cases/make/remove-dynamic-entry-with-loader/index.test.ts | Replaced manual page reload with direct toContainText assertion that relies on HMR |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Problem
remove-dynamic-entry-with-loader
Panic during E2E testing
Root Cause Analysis
The problem occurs as follows:
page.reload.DerefOption<build_module_graph_artifact>is being executed.page.reloadinitiates a new HMR (Hot Module Replacement) connection to the development server. The server sends stats to the new HMR client, which triggers a stats.toJson() call that requires the module graph.Solution
singleruntime chunk to use HMR for reloading the page once the compilation is completed.page.reloadin the test to avoid race conditions.Related Links
Checklist