Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): add stubs for perf_hooks.PerformaceObserver #23958

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ext/node/polyfills/perf_hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions tests/unit_node/perf_hooks_test.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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);
},
});

Expand Down