diff options
author | Tareque Md Hanif <tarequemd.hanif@yahoo.com> | 2023-11-11 03:29:09 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 14:29:09 -0700 |
commit | eff3e432966f6bc9ed909ba22fcafc0978c924d7 (patch) | |
tree | 9081548c2f804f312121673c4070825831605495 /cli/tests/unit/performance_test.ts | |
parent | df14835b83085017e9cf9ae66a71cd523385c5c4 (diff) |
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
Diffstat (limited to 'cli/tests/unit/performance_test.ts')
-rw-r--r-- | cli/tests/unit/performance_test.ts | 7 |
1 files changed, 3 insertions, 4 deletions
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<void>(); 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); }); |