fix: suppress ESModulesLinkingError for exports that might be implemented in mock#704
Merged
fix: suppress ESModulesLinkingError for exports that might be implemented in mock#704
Conversation
✅ Deploy Preview for rstest-dev 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 suppresses ESModulesLinkingError warnings that occur when mocked modules export properties that don't exist in the original module by changing the exportsPresence configuration from 'error' to 'warn'.
- Changed rspack's
exportsPresenceparser option from'error'to'warn'to allow mock modules to add exports not present in the original module - Added E2E test to verify that ESModulesLinkingError is not thrown when mocking modules with additional exports
- Updated test snapshots to reflect the new configuration
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/core/plugins/basic.ts | Added exportsPresence: 'warn' configuration to suppress ESModulesLinkingError when mocks define exports not in the original module |
| packages/core/tests/core/snapshots/rsbuild.test.ts.snap | Updated all 5 snapshot occurrences to reflect the change from "error" to "warn" |
| e2e/mock/tests/esModulesLinkingError.test.ts | Added E2E test that verifies ESModulesLinkingError is not printed when running tests with mocked exports |
| e2e/mock/fixtures/esModulesLinkingError/index.test.ts | Created test fixture that mocks a module with exports not present in the original |
| e2e/mock/fixtures/esModulesLinkingError/services/index.js | Created minimal module that exports a while the mock provides value |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
chenjiahan
reviewed
Nov 19, 2025
Member
chenjiahan
left a comment
There was a problem hiding this comment.
Should we use fix instead of chore in the PR title?
Merged
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
suppress ESModulesLinkingError for exports that might be implemented in mock.
mock modules:
Related Links
#698
Checklist