From eff3e432966f6bc9ed909ba22fcafc0978c924d7 Mon Sep 17 00:00:00 2001 From: Tareque Md Hanif Date: Sat, 11 Nov 2023 03:29:09 +0600 Subject: chore(cli): Migrate some unit tests to "Promise.withResolvers()" (#21128) Migrate to use `Promise.withResolvers()` instead of `deferred` in some of the tests in `cli/tests/unit/`. Issue: #21041 --- cli/tests/unit/performance_test.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'cli/tests/unit/performance_test.ts') diff --git a/cli/tests/unit/performance_test.ts b/cli/tests/unit/performance_test.ts index accedd2e4..401ce2c16 100644 --- a/cli/tests/unit/performance_test.ts +++ b/cli/tests/unit/performance_test.ts @@ -5,19 +5,18 @@ import { assertNotStrictEquals, assertStringIncludes, assertThrows, - deferred, } from "./test_util.ts"; Deno.test({ permissions: { hrtime: false } }, async function performanceNow() { - const resolvable = deferred(); + const { promise, resolve } = Promise.withResolvers(); const start = performance.now(); let totalTime = 0; setTimeout(() => { const end = performance.now(); totalTime = end - start; - resolvable.resolve(); + resolve(); }, 10); - await resolvable; + await promise; assert(totalTime >= 10); }); -- cgit v1.2.3