From 9e243d22f4ea9642e24415e5484f0f067f466ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 4 Sep 2023 23:05:06 +0200 Subject: Revert "refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' (#20303) (#20370) This reverts commit https://github.com/denoland/deno/commit/83426be6eead06c680ae527468aeaf8723543ff2. Includes a regression test. --- cli/tests/unit/timers_test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cli') diff --git a/cli/tests/unit/timers_test.ts b/cli/tests/unit/timers_test.ts index 5c076ad09..6dedb04ed 100644 --- a/cli/tests/unit/timers_test.ts +++ b/cli/tests/unit/timers_test.ts @@ -756,3 +756,20 @@ Deno.test({ assertEquals(timeoutsFired.length, 300); }, }); + +// Regression test for https://github.com/denoland/deno/issues/20367 +Deno.test({ + name: "regression for #20367", + fn: async () => { + const promise = deferred(); + const start = performance.now(); + setTimeout(() => { + const end = performance.now(); + promise.resolve(end - start); + }, 1000); + clearTimeout(setTimeout(() => {}, 1000)); + + const result = await promise; + assert(result >= 1000); + }, +}); -- cgit v1.2.3