test(bundler): cover named-export globalThis registration

This commit is contained in:
pj committed 2026-06-01 21:04:19 +05:30
1 parent e156fbc5f6
commit 955d0a67ff
2 files changed
+57 -2

No files matched your search

+4 -2
View File
@@ -34,8 +34,8 @@ export {};
const fakeSpec = `
const handle = (globalThis as { __sanderling__: { extract: (g: () => unknown) => unknown } }).__sanderling__.extract(() => 42);
(globalThis as { actions?: unknown }).actions = handle;
export {};
export const actionsRoot = handle;
export const properties = "WEB_PROPS_MARKER";
`
func TestBundleWeb_RegistersExpectedGlobals(t *testing.T) {
@@ -61,6 +61,8 @@ func TestBundleWeb_RegistersExpectedGlobals(t *testing.T) {
"__sanderlingExtractors__",
"__sanderlingNextAction__",
"__sanderling__",
"WEB_PROPS_MARKER",
"globalThis.actions",
} {
if !strings.Contains(source, expected) {
t.Errorf("bundle missing %q\nsource head:\n%s", expected, head(source, 500))