Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
=======================================
Coverage 97.08% 97.08%
=======================================
Files 9 9
Lines 343 343
Branches 73 73
=======================================
Hits 333 333
Misses 10 10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description of changes:
Problem: In a native ES module,
import createWrapper from '@cloudscape-design/components/test-utils/selectors'gives an object, not the function, socreateWrapper()throwsTypeError: createWrapper is not a function. The same happens fortest-utils/dom.Root cause: The generated
test-utils/{dom,selectors}/index.jsfiles are CommonJS and export the function only asexports.default. When an ES module imports a CommonJS file, Node maps the default import to the wholemodule.exportsobject, so the function ends up atcreateWrapper.default.Fix: The generated index files also export the function by name:
This compiles to
exports.createWrapper = wrapper, which Node detects as a named export. ESM code can then write:The default export does not change, so existing imports keep working.
How has this been tested?
createWrapperby name for bothdomandselectors.domandselectorsindex files to CommonJS and imported them from native ESM in Node 22:createWrapperis a function in both.npm run build,npm run lintandnpm test(includingverify-typescript) pass.Issue #, if available:
Related: cloudscape-design/components#5261
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.