Skip to content

Commit

Permalink
fix: add test ensuring als works across dynamic import (#25593)
Browse files Browse the repository at this point in the history
The fix is in denoland/deno_core#888

Fixes: #25275

Signed-off-by: snek <snek@deno.com>
  • Loading branch information
devsnek authored Sep 12, 2024
1 parent 11b5f2d commit c906510
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/unit_node/async_hooks_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});

0 comments on commit c906510

Please sign in to comment.