summaryrefslogtreecommitdiff
path: root/cli/tests/unit/performance_test.ts
diff options
context:
space:
mode:
authorTareque Md Hanif <tarequemd.hanif@yahoo.com>2023-11-11 03:29:09 +0600
committerGitHub <noreply@github.com>2023-11-10 14:29:09 -0700
commiteff3e432966f6bc9ed909ba22fcafc0978c924d7 (patch)
tree9081548c2f804f312121673c4070825831605495 /cli/tests/unit/performance_test.ts
parentdf14835b83085017e9cf9ae66a71cd523385c5c4 (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.ts7
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);
});