diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/timers_test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
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<number>(); + const start = performance.now(); + setTimeout(() => { + const end = performance.now(); + promise.resolve(end - start); + }, 1000); + clearTimeout(setTimeout(() => {}, 1000)); + + const result = await promise; + assert(result >= 1000); + }, +}); |