summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/perf_hooks.ts
diff options
context:
space:
mode:
authorMarvin Hagemeister <marvin@deno.com>2024-07-10 19:47:45 +0200
committerGitHub <noreply@github.com>2024-07-10 19:47:45 +0200
commit26288cf2a97334e6d8e6697d0b858ad8582802b9 (patch)
treefd8ae58bf7eff1ce47db45f7e8804bebc3a3c681 /ext/node/polyfills/perf_hooks.ts
parent60668c1e9370229f253b52a67cba983ce4cdac63 (diff)
fix(node/perf_hooks): stub eventLoopUtilization (#24501)
This PR stubs `perf_hooks.eventLoopUtilization` to make the tests of [hapi](https://github.com/hapijs/hapi) start. Previously, they'd all error because of this function throwing a not implemented error. This brings down the test failures in their suite from 982 to 68 failures.
Diffstat (limited to 'ext/node/polyfills/perf_hooks.ts')
-rw-r--r--ext/node/polyfills/perf_hooks.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/node/polyfills/perf_hooks.ts b/ext/node/polyfills/perf_hooks.ts
index b58321ffa..d48635856 100644
--- a/ext/node/polyfills/perf_hooks.ts
+++ b/ext/node/polyfills/perf_hooks.ts
@@ -26,8 +26,11 @@ const performance:
"clearMeasures" | "getEntries"
>
& {
- // deno-lint-ignore no-explicit-any
- eventLoopUtilization: any;
+ eventLoopUtilization(): {
+ idle: number;
+ active: number;
+ utilization: number;
+ };
nodeTiming: Record<string, string>;
// deno-lint-ignore no-explicit-any
timerify: any;
@@ -37,8 +40,10 @@ const performance:
markResourceTiming: any;
} = {
clearMarks: (markName: string) => shimPerformance.clearMarks(markName),
- eventLoopUtilization: () =>
- notImplemented("eventLoopUtilization from performance"),
+ eventLoopUtilization: () => {
+ // TODO(@marvinhagemeister): Return actual non-stubbed values
+ return { idle: 0, active: 0, utilization: 0 };
+ },
mark: (markName: string) => shimPerformance.mark(markName),
measure: (
measureName: string,