Conversation
✅ Deploy Preview for rspack canceled.
|
Contributor
📦 Binary Size-limit
❌ Size increased by 7.88KB from 56.70MB to 56.71MB (⬆️0.01%) |
CodSpeed Performance ReportMerging #11050 will not alter performanceComparing 🎉 Hooray!
|
fe64871 to
6b3f63f
Compare
LingyuCoder
approved these changes
Jul 18, 2025
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
The runtime code modification and integration test case is added in Rstest repository web-infra-dev/rstest#389.
This PR is to resolve two main issues in Rstest mock side:
Issue: mock hoist order conflict: if the mock for
../src/cis hoisted to a position that is too top, the mock factory in../src/cwill access an uninitialized (undefined)rsobject.Solution: When a mock factory exists, hoist
.mockto the placeholder by usingInitFragmentStage::StageAsyncESMImportsand set itspositionto the maximum. Additionally, add the linevar _src_c__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./mock/src/c.ts");to refresh the reference to_src_c__WEBPACK_IMPORTED_MODULE_1__.Issue: async mock factory: In the example below, the async function in the mock factory must be awaited before executing the test case.
Solution: For the
.mockmethod with a mock factory, insert the lineawait __webpack_require__.rstest_exec("../src/d"). Additionally, mark all modules with a factory in their.mockmethods asasync(TLA) so that the previously mentionedawaitcan be used with the module TLA.Here's an image to helping understand what init fragments are injected.
Related links
Checklist