fix(rstest): avoid async wrapper for sync mock factories#13764
fix(rstest): avoid async wrapper for sync mock factories#13764
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the rstest parser behavior to avoid marking hoisted synchronous rs.mock() calls as async modules, and tightens regression coverage by asserting the emitted bundle remains hoisted and free of async-module runtime markers.
Changes:
- Removed logic that marked modules as having top-level await when encountering hoisted rstest mocks.
- Strengthened the rstest mock config case to assert correct hoist ordering and absence of async-module runtime wrappers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/rspack-test/configCases/rstest/mock/test.js | Expands assertions around hoisting order and verifies no async-module runtime markers are emitted. |
| crates/rspack_plugin_rstest/src/parser_plugin.rs | Stops hoisted mocks from unconditionally setting async/top-level-await metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 553ae60190
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
📦 Binary Size-limit
🙈 Size remains the same at 62.81MB |
Rsdoctor Bundle Diff AnalysisFound 6 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
Summary
This PR stops hoisted
rs.mock(..., () => ({ ... }))calls from marking rstest entries as async modules, which removed the unnecessary async wrapper from the generated bundle. It also strengthens the rstest mock case to assert the emittedbundle1.jsis still hoisted correctly and does not contain async module runtime markers.Related links
None.
Checklist