diff options
author | snek <snek@deno.com> | 2024-09-11 22:42:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-12 05:42:26 +0000 |
commit | c9065103b8ef0317fd8141f554fdc0a2f801e844 (patch) | |
tree | 2ccc7ff72a6e7a7e7eb856cf9d934c434188cde6 /tests/unit_node | |
parent | 11b5f2d3ea325a2e6792e4b75fddfcea8a593fb7 (diff) |
fix: add test ensuring als works across dynamic import (#25593)
The fix is in https://github.com/denoland/deno_core/pull/888
Fixes: https://github.com/denoland/deno/issues/25275
Signed-off-by: snek <snek@deno.com>
Diffstat (limited to 'tests/unit_node')
-rw-r--r-- | tests/unit_node/async_hooks_test.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit_node/async_hooks_test.ts b/tests/unit_node/async_hooks_test.ts index 91130972c..edad57bf7 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"); + }); +}); |