From 70fcae604d9f174eb3a21c78e38b72ff7ea3e98e Mon Sep 17 00:00:00 2001 From: Andrew DiZenzo Date: Wed, 3 Jun 2026 17:25:54 +0000 Subject: [PATCH] test(parity): cover dynamic import local candidates --- .../loader/dynamic-import-local-candidates.ts | 20 +++++++++++++++++++ .../module/loader/fixtures/dynamic-local-a.ts | 2 ++ .../module/loader/fixtures/dynamic-local-b.ts | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 test-parity/node-suite/module/loader/dynamic-import-local-candidates.ts create mode 100644 test-parity/node-suite/module/loader/fixtures/dynamic-local-a.ts create mode 100644 test-parity/node-suite/module/loader/fixtures/dynamic-local-b.ts diff --git a/test-parity/node-suite/module/loader/dynamic-import-local-candidates.ts b/test-parity/node-suite/module/loader/dynamic-import-local-candidates.ts new file mode 100644 index 0000000000..a2acc89980 --- /dev/null +++ b/test-parity/node-suite/module/loader/dynamic-import-local-candidates.ts @@ -0,0 +1,20 @@ +// @ts-nocheck +async function loadFromLet(flag: boolean) { + let specifier = flag + ? "./fixtures/dynamic-local-a.ts" + : "./fixtures/dynamic-local-b.ts"; + const mod = await import(specifier); + return mod.value; +} + +async function loadFromTemplate(flag: boolean) { + let name = flag ? "a" : "b"; + let specifier = `./fixtures/dynamic-local-${name}.ts`; + const mod = await import(specifier); + return mod.templateValue; +} + +console.log("let true:", await loadFromLet(true)); +console.log("let false:", await loadFromLet(false)); +console.log("template true:", await loadFromTemplate(true)); +console.log("template false:", await loadFromTemplate(false)); diff --git a/test-parity/node-suite/module/loader/fixtures/dynamic-local-a.ts b/test-parity/node-suite/module/loader/fixtures/dynamic-local-a.ts new file mode 100644 index 0000000000..77d0d847cf --- /dev/null +++ b/test-parity/node-suite/module/loader/fixtures/dynamic-local-a.ts @@ -0,0 +1,2 @@ +export const value = "local-a"; +export const templateValue = "template-a"; diff --git a/test-parity/node-suite/module/loader/fixtures/dynamic-local-b.ts b/test-parity/node-suite/module/loader/fixtures/dynamic-local-b.ts new file mode 100644 index 0000000000..bf29d4ad35 --- /dev/null +++ b/test-parity/node-suite/module/loader/fixtures/dynamic-local-b.ts @@ -0,0 +1,2 @@ +export const value = "local-b"; +export const templateValue = "template-b";