fix: rewrite re-export sources to selectors - #131
Open
bmv437 wants to merge 1 commit into
Open
Conversation
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.
Issue #, if available:
Description of changes:
Description
The selectors converter only rewrote module paths on import declarations, so re-export
declarations pointing at a Cloudscape
/domentry were left alone. A wrapper written asexport { default } from '@cloudscape-design/components/test-utils/dom/button'produced aselectors variant that still pointed at the DOM wrapper, which breaks selectors generation for
consumers that build their own scoped test-utils.
This PR applies the same
/dom->/selectorsrewrite toExportNamedDeclarationandExportAllDeclarationsources. The shared logic moved into a small helper so imports andre-exports stay in sync. Local exports such as
export { value }andexport default valuehaveno module source and are left untouched.
How has this been tested?
Added a converter input at
src/converter/test/inputs/converter-no-typecheck/reexport-source.tsthat covers both re-export forms (
export { default } from ...andexport * from ...) next toplain local exports, so one snapshot pins both halves of the behavior: the re-export sources get
rewritten, and the local exports are left alone.
Reviewers can run
npm test(11 files, 92 tests) and read the newreexport-source 1entry insrc/converter/test/__snapshots__/converter.test.ts.snap, where the two re-exports now resolve to.../test-utils/selectors/buttonand.../test-utils/selectors/container.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.