From 686ec85f5220327933d1dfae0e73dabbfc33bc45 Mon Sep 17 00:00:00 2001 From: await-ovo <13152410380@163.com> Date: Wed, 5 Jul 2023 01:19:18 +0800 Subject: fix(ext/node): Define performance.timeOrigin as getter property (#19714) --- cli/tests/unit_node/perf_hooks_test.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'cli/tests/unit_node/perf_hooks_test.ts') diff --git a/cli/tests/unit_node/perf_hooks_test.ts b/cli/tests/unit_node/perf_hooks_test.ts index 78375d54d..2249e62f8 100644 --- a/cli/tests/unit_node/perf_hooks_test.ts +++ b/cli/tests/unit_node/perf_hooks_test.ts @@ -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(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; + }); + }, +}); -- cgit v1.2.3