diff --git a/tests/unit_node/async_hooks_test.ts b/tests/unit_node/async_hooks_test.ts index 91130972c5..edad57bf76 100644 --- a/tests/unit_node/async_hooks_test.ts +++ b/tests/unit_node/async_hooks_test.ts @@ -160,3 +160,15 @@ Deno.test(async function worksWithAsyncAPIs() { test(); }); }); + +Deno.test(async function worksWithDynamicImports() { + const store = new AsyncLocalStorage(); + // @ts-expect-error implicit any + globalThis.alsDynamicImport = () => store.getStore(); + const dataUrl = + `data:application/javascript,export const data = alsDynamicImport()`; + await store.run("data", async () => { + const { data } = await import(dataUrl); + assertEquals(data, "data"); + }); +});