fix(rstest): resolve manual mock targets with resolver#13439
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ca43b01c7
ℹ️ 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".
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
❌ Size increased by 21.00KB from 48.97MB to 48.99MB (⬆️0.04%) |
Merging this PR will not alter performance
Comparing Footnotes
|
fi3ework
left a comment
There was a problem hiding this comment.
- should respect
mainFilesinstead of hard codeindex - better to use resolver to resolve instead of manually
is_dir
Deploying rspack with
|
| Latest commit: |
2a4732a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ca5a9b27.rspack-v2.pages.dev |
| Branch Preview URL: | https://rstest-mock-resolve.rspack-v2.pages.dev |
__mocks__|
👍🏻 |
Summary
resolve manual mock targets with resolver.
Fix the case where a mocked relative request resolves through a directory entry file such as
index.js/index.ts.Before this change,
rs.mock("./common")would resolve the mock target as./__mocks__/common, even when./commonactually resolved to./common/index.ts. That caused rstest to miss mocks placed under./common/__mocks__/index.After this change, when a relative mock request points to a real directory, rstest resolves the manual mock to the nested directory form:
./common./common/index.ts./common/__mocks__/indexRelated links
fix web-infra-dev/rstest#613
Checklist