Files
bun.sh/test/js/node/perf_hooks/perf_hooks.test.ts
2025-05-26 21:18:22 -07:00

26 lines
1.0 KiB
TypeScript

import { expect, test } from "bun:test";
import perf from "perf_hooks";
test("stubs", () => {
expect(!!perf.monitorEventLoopDelay).toBeFalse();
expect(() => perf.monitorEventLoopDelay()).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();
expect(() => performance.markResourceTiming()).not.toThrow();
});