summaryrefslogtreecommitdiff
path: root/tests/unit_node/perf_hooks_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_node/perf_hooks_test.ts')
-rw-r--r--tests/unit_node/perf_hooks_test.ts19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/unit_node/perf_hooks_test.ts b/tests/unit_node/perf_hooks_test.ts
index 8247f9fd3..83d006222 100644
--- a/tests/unit_node/perf_hooks_test.ts
+++ b/tests/unit_node/perf_hooks_test.ts
@@ -5,7 +5,7 @@ import {
performance,
PerformanceObserver,
} from "node:perf_hooks";
-import { assertEquals, assertThrows } from "@std/assert";
+import { assert, assertEquals, assertThrows } from "@std/assert";
Deno.test({
name: "[perf_hooks] performance",
@@ -73,11 +73,16 @@ Deno.test("[perf_hooks]: eventLoopUtilization", () => {
assertEquals(typeof obj.utilization, "number");
});
-Deno.test("[perf_hooks]: monitorEventLoopDelay", () => {
- const e = assertThrows(() => {
- monitorEventLoopDelay({ resolution: 1 });
- });
+Deno.test("[perf_hooks]: monitorEventLoopDelay", async () => {
+ const e = monitorEventLoopDelay();
+ assertEquals(e.count, 0);
+ e.enable();
- // deno-lint-ignore no-explicit-any
- assertEquals((e as any).code, "ERR_NOT_IMPLEMENTED");
+ await new Promise((resolve) => setTimeout(resolve, 100));
+
+ assert(e.min > 0);
+ assert(e.minBigInt > 0n);
+ assert(e.count > 0);
+
+ e.disable();
});