mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
fix(ext/node): Define performance.timeOrigin as getter property (#19714)
This commit is contained in:
parent
a3986b641c
commit
686ec85f52
2 changed files with 19 additions and 3 deletions
|
@ -1,7 +1,10 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import * as perfHooks from "node:perf_hooks";
|
||||
import { performance } from "node:perf_hooks";
|
||||
import { assertEquals } from "../../../test_util/std/testing/asserts.ts";
|
||||
import {
|
||||
assertEquals,
|
||||
assertThrows,
|
||||
} from "../../../test_util/std/testing/asserts.ts";
|
||||
|
||||
Deno.test({
|
||||
name: "[perf_hooks] performance",
|
||||
|
@ -39,3 +42,14 @@ Deno.test({
|
|||
assertEquals<unknown>(perfHooks.PerformanceEntry, PerformanceEntry);
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "[perf_hooks] performance.timeOrigin",
|
||||
fn() {
|
||||
assertEquals(typeof performance.timeOrigin, "number");
|
||||
assertThrows(() => {
|
||||
// @ts-expect-error: Cannot assign to 'timeOrigin' because it is a read-only property
|
||||
performance.timeOrigin = 1;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue