summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/perf_hooks_test.ts
diff options
context:
space:
mode:
authorawait-ovo <13152410380@163.com>2023-07-05 01:19:18 +0800
committerGitHub <noreply@github.com>2023-07-04 20:19:18 +0300
commit686ec85f5220327933d1dfae0e73dabbfc33bc45 (patch)
tree14c02bf76cea3a176ba2f615f40dc4197209032c /cli/tests/unit_node/perf_hooks_test.ts
parenta3986b641c892c09b514aab76c04324e75e18f9d (diff)
fix(ext/node): Define performance.timeOrigin as getter property (#19714)
Diffstat (limited to 'cli/tests/unit_node/perf_hooks_test.ts')
-rw-r--r--cli/tests/unit_node/perf_hooks_test.ts16
1 files changed, 15 insertions, 1 deletions
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<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;
+ });
+ },
+});