-
-
Notifications
You must be signed in to change notification settings - Fork 357
feat(enhanced): implement layer-aware module sharing with comprehensive test coverage (PR9) #3915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 80a7180 The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- Remove accidentally added vite git submodule from repository - Add changeset for PR #3915 (Enhanced Layer Support) - Documents issuerLayer fallback logic implementation - Minor version bump for new feature - Add changeset for PR #3969 (Comprehensive Test Coverage) - Documents 73 tests for ProvideSharedPlugin - Documents 70+ tests for ConsumeSharedPlugin - Patch version bumps for test additions These changesets ensure proper version bumping and changelog generation for the incremental PR features and test coverage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
cec11f2
to
c1b3918
Compare
806abf2
to
217ba68
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
e90cbb9
to
d47ebc1
Compare
d47ebc1
to
eac5e94
Compare
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Add silent: true and verbose: false to Jest config to reduce console noise - Remove incomplete consume-shared-with-alias test directory that was missing webpack.config.js - This improves test readability while maintaining all functional test coverage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Co-authored-by: Claude <[email protected]>
Remove all HTML, CSS, and JS coverage report files that were accidentally committed. These files are auto-generated and should not be tracked in version control.
Co-authored-by: Claude <[email protected]>
c476e89
to
58442a7
Compare
@@ -0,0 +1,378 @@ | |||
# Enhanced Module Federation - Unit Tests | |||
|
|||
This directory contains comprehensive unit tests for the Enhanced Module Federation package. Tests are organized by functional area and component, providing extensive coverage for core Module Federation features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this
Apply suggested changes
Apply suggested changes
@@ -0,0 +1,14 @@ | |||
--- | |||
"@module-federation/enhanced": minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this a patch and update it based on the actual changes in the pr (if any) otherwise delete
Apply suggested changes
- Add apply method tests for plugin registration logic and hook setup | ||
- Achieve test coverage parity with ProvideSharedPlugin (70+ tests each) | ||
|
||
This addresses the requirement for "immense test coverage for consume share plugin and provide share plugin to cover all its very complex logic" and ensures comprehensive testing of multi-stage module resolution, layer matching, version filtering, and error handling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
- Update ModuleNotFoundError mock to return an instance with proper structure - Add validation for error object structure in test assertions - Ensures tests correctly verify error handling in resolveMatchedConfigs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove extra wrapper function that was breaking the mock - Ensure mock returns constructor function directly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Summary
This PR implements enhanced layer support for module sharing in Module Federation, enabling layer-aware module resolution with proper fallback mechanisms. It also includes comprehensive test coverage for both ConsumeSharedPlugin and ProvideSharedPlugin.
Key Features
🎯 Layer-Aware Module Sharing
issuerLayer
parameter support throughout ConsumeSharedPlugin and related modulescreateLookupKeyForSharing
utility to generate layer-aware lookup keys (e.g.,(client)react
,(server)express
)🧪 Comprehensive Test Coverage
ConsumeSharedPlugin: Added 70+ tests covering all critical business logic including:
ProvideSharedPlugin: Added 73 tests covering:
🔧 Additional Improvements
extractPathAfterNodeModules
utilityImplementation Details
The layer support follows a consistent fallback pattern across all resolution stages:
This enables scenarios like:
(client)react
(server)express
Testing
Breaking Changes
None - all changes are backward compatible with existing configurations.
Related Issues
Completes PR9 implementation as defined in the incremental PR plan for enhanced layer support.