diff options
author | snek <snek@deno.com> | 2024-08-02 11:16:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 18:16:59 +0000 |
commit | 71ca61e189cca9215982ce4598b7a4da8430c584 (patch) | |
tree | a0dd2aa94cf61103b1dbcfa28a6c67feebf6eedd /tests/unit_node/async_hooks_test.ts | |
parent | 3a1a1cc030fb7fc90d51ee27162466d6ac924926 (diff) |
Revert "feat: async context" (#24856)
Reverts denoland/deno#24402
deno_web can't depend on code in runtime
Diffstat (limited to 'tests/unit_node/async_hooks_test.ts')
-rw-r--r-- | tests/unit_node/async_hooks_test.ts | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/tests/unit_node/async_hooks_test.ts b/tests/unit_node/async_hooks_test.ts index 91130972c..f153f6753 100644 --- a/tests/unit_node/async_hooks_test.ts +++ b/tests/unit_node/async_hooks_test.ts @@ -1,7 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { AsyncLocalStorage, AsyncResource } from "node:async_hooks"; -import process from "node:process"; -import { setImmediate } from "node:timers"; import { assert, assertEquals } from "@std/assert"; Deno.test(async function foo() { @@ -94,7 +92,7 @@ Deno.test(async function enterWith() { }); assertEquals(await deferred.promise, { x: 2 }); - assertEquals(await deferred1.promise, null); + assertEquals(await deferred1.promise, { x: 1 }); }); Deno.test(async function snapshot() { @@ -137,26 +135,3 @@ Deno.test(function emitDestroyStub() { const resource = new AsyncResource("foo"); assert(typeof resource.emitDestroy === "function"); }); - -Deno.test(async function worksWithAsyncAPIs() { - const store = new AsyncLocalStorage(); - const test = () => assertEquals(store.getStore(), "data"); - await store.run("data", async () => { - test(); - queueMicrotask(() => test()); - process.nextTick(() => test()); - setImmediate(() => test()); - setTimeout(() => test(), 0); - const intervalId = setInterval(() => { - test(); - clearInterval(intervalId); - }, 0); - - store.run("data2", () => { - assertEquals(store.getStore(), "data2"); - }); - - await new Promise((r) => setTimeout(r, 50)); - test(); - }); -}); |