test(e2e): fix unstable rspack profile cases#5507
Merged
chenjiahan merged 2 commits intomainfrom Jun 30, 2025
Merged
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR stabilizes the rspack profile end-to-end tests by extracting shared logic into a helper, switching from exec to spawn, and ensuring the dev server process exits when compilation finishes.
- Extracted an
expectProfileFilehelper to reduce duplication - Updated both dev and build tests to use
spawnand the shared helper - Added a
onDevCompileDoneexit hook indev.mjsto prevent hanging
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| e2e/cases/rspack-profile/index.test.ts | Refactored tests to use expectProfileFile, replaced exec with spawn |
| e2e/cases/rspack-profile/dev.mjs | Added rsbuild.onDevCompileDone callback to gracefully exit process |
Comments suppressed due to low confidence (3)
e2e/cases/rspack-profile/index.test.ts:42
- [nitpick] For consistency and readability in test titles, consider capitalizing “RSPack” (e.g. 'should generate RSPack profile as expected in dev').
'should generate rspack profile as expected in dev',
e2e/cases/rspack-profile/index.test.ts:18
- Consider also listening to
childProcess.stderralongsidestdout, since some tools emit logs or errors on stderr which your test might miss.
const expectProfileFile = async (
e2e/cases/rspack-profile/dev.mjs:25
- Immediately calling
process.exit(0)may terminate the process before the profile file is fully flushed; consider waiting for the profile save log event or ensuring the file write completes before exiting.
rsbuild.onDevCompileDone(() => {
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
Fix the unstable rspack profile E2E cases, see:
Checklist