Files
bun.sh/test/js/node/perf_hooks/perf_hooks.test.ts
Jarred Sumner 3c785c88fb Fix issue with perf_hooks in canary (#8279)
* Update perf_hooks.ts

* Update perf_hooks.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-19 05:22:06 -08:00

25 lines
992 B
TypeScript

import perf from "perf_hooks";
import { test, expect } from "bun:test";
test("stubs", () => {
expect(() => perf.monitorEventLoopDelay()).toThrow();
expect(() => perf.createHistogram()).toThrow();
expect(perf.performance.nodeTiming).toBeObject();
expect(perf.performance.now()).toBeNumber();
expect(perf.performance.timeOrigin).toBeNumber();
expect(perf.performance.eventLoopUtilization()).toBeObject();
});
test("doesn't throw", () => {
expect(() => performance.mark("test")).not.toThrow();
expect(() => performance.measure("test", "test")).not.toThrow();
expect(() => performance.clearMarks()).not.toThrow();
expect(() => performance.clearMeasures()).not.toThrow();
expect(() => performance.getEntries()).not.toThrow();
expect(() => performance.getEntriesByName("test")).not.toThrow();
expect(() => performance.getEntriesByType("measure")).not.toThrow();
expect(() => performance.now()).not.toThrow();
expect(() => performance.timeOrigin).not.toThrow();
});