Skip to content

Commit

Permalink
fix: add test ensuring als works across dynamic import
Browse files Browse the repository at this point in the history
Fixes: #25275

Signed-off-by: snek <snek@deno.com>
  • Loading branch information
devsnek authored Sep 12, 2024
1 parent 57556ad commit 20c1728
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 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,14 @@ Deno.test(async function worksWithAsyncAPIs() {
test();
});
});

Deno.test(async function worksWithDynamicImports() {
const store = new AsyncLocalStorage();
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 20c1728

Please # to comment.