summaryrefslogtreecommitdiff
path: root/cli/tests/unit/performance_test.ts
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2021-08-25 16:04:14 -0400
committerGitHub <noreply@github.com>2021-08-25 16:04:14 -0400
commit5d7d9d64434bd0a9f1fcf391dabc51693e8cf1ae (patch)
treec217fac5a7d67ba326d456b2973d23a7c7b151d4 /cli/tests/unit/performance_test.ts
parent66476efec5b92cd04c161d82cbb69992fed4eb0a (diff)
chore(tests): improve unit tests using `deferred` (#11842)
Diffstat (limited to 'cli/tests/unit/performance_test.ts')
-rw-r--r--cli/tests/unit/performance_test.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/tests/unit/performance_test.ts b/cli/tests/unit/performance_test.ts
index 989d221d8..7ea1720a5 100644
--- a/cli/tests/unit/performance_test.ts
+++ b/cli/tests/unit/performance_test.ts
@@ -11,12 +11,14 @@ import {
unitTest({ perms: { hrtime: false } }, async function performanceNow() {
const resolvable = deferred();
const start = performance.now();
+ let totalTime = 0;
setTimeout(() => {
const end = performance.now();
- assert(end - start >= 10);
+ totalTime = end - start;
resolvable.resolve();
}, 10);
await resolvable;
+ assert(totalTime >= 10);
});
unitTest(function performanceMark() {