diff options
-rw-r--r-- | ext/node/polyfills/perf_hooks.ts | 11 | ||||
-rw-r--r-- | tests/unit_node/perf_hooks_test.ts | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/ext/node/polyfills/perf_hooks.ts b/ext/node/polyfills/perf_hooks.ts index 44ab88f98..b58321ffa 100644 --- a/ext/node/polyfills/perf_hooks.ts +++ b/ext/node/polyfills/perf_hooks.ts @@ -9,8 +9,15 @@ import { PerformanceEntry, } from "ext:deno_web/15_performance.js"; -// FIXME(bartlomieju) -const PerformanceObserver = undefined; +class PerformanceObserver { + observe() { + notImplemented("PerformanceObserver.observe"); + } + disconnect() { + notImplemented("PerformanceObserver.disconnect"); + } +} + const constants = {}; const performance: diff --git a/tests/unit_node/perf_hooks_test.ts b/tests/unit_node/perf_hooks_test.ts index d6f58d1cf..86c4aee4c 100644 --- a/tests/unit_node/perf_hooks_test.ts +++ b/tests/unit_node/perf_hooks_test.ts @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import * as perfHooks from "node:perf_hooks"; -import { performance } from "node:perf_hooks"; +import { performance, PerformanceObserver } from "node:perf_hooks"; import { assertEquals, assertThrows } from "@std/assert/mod.ts"; Deno.test({ @@ -44,9 +44,10 @@ Deno.test({ }); Deno.test({ - name: "[perf_hooks] PerformanceEntry", + name: "[perf_hooks] PerformanceEntry & PerformanceObserver", fn() { assertEquals<unknown>(perfHooks.PerformanceEntry, PerformanceEntry); + assertEquals<unknown>(perfHooks.PerformanceObserver, PerformanceObserver); }, }); |