Skip to content

fix: rewrite re-export sources to selectors - #131

Open
bmv437 wants to merge 1 commit into
cloudscape-design:mainfrom
bmv437:fix/converter-rewrite-reexport-sources
Open

fix: rewrite re-export sources to selectors#131
bmv437 wants to merge 1 commit into
cloudscape-design:mainfrom
bmv437:fix/converter-rewrite-reexport-sources

Conversation

@bmv437

@bmv437 bmv437 commented Jul 31, 2026

Copy link
Copy Markdown

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 /dom entry were left alone. A wrapper written as
export { default } from '@cloudscape-design/components/test-utils/dom/button' produced a
selectors 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 -> /selectors rewrite to ExportNamedDeclaration and
ExportAllDeclaration sources. The shared logic moved into a small helper so imports and
re-exports stay in sync. Local exports such as export { value } and export default value have
no 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.ts
that covers both re-export forms (export { default } from ... and export * from ...) next to
plain 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 new reexport-source 1 entry in
src/converter/test/__snapshots__/converter.test.ts.snap, where the two re-exports now resolve to
.../test-utils/selectors/button and .../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.

@bmv437
bmv437 requested a review from a team as a code owner July 31, 2026 20:56
@bmv437
bmv437 requested review from srungta08 and removed request for a team July 31, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant