From 2b13bb694532904704c16bec4e8a47c386e681e2 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 30 Jul 2021 01:15:11 +0530 Subject: feat(runtime): implement navigator.hardwareConcurrency (#11448) This commit implements "navigator.hardwareConcurrency" API, which supersedes "Deno.systemCpuInfo()" API (which was removed in this commit). --- cli/tests/unit/navigator_test.ts | 6 ++++++ cli/tests/unit/os_test.ts | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 cli/tests/unit/navigator_test.ts (limited to 'cli/tests') diff --git a/cli/tests/unit/navigator_test.ts b/cli/tests/unit/navigator_test.ts new file mode 100644 index 000000000..10475d973 --- /dev/null +++ b/cli/tests/unit/navigator_test.ts @@ -0,0 +1,6 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +import { assert, unitTest } from "./test_util.ts"; + +unitTest(function navigatorNumCpus(): void { + assert(navigator.hardwareConcurrency > 0); +}); diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts index 9b0f71352..daa7a1ca2 100644 --- a/cli/tests/unit/os_test.ts +++ b/cli/tests/unit/os_test.ts @@ -203,9 +203,3 @@ unitTest({ perms: { env: true } }, function systemMemoryInfo(): void { assert(info.swapTotal >= 0); assert(info.swapFree >= 0); }); - -unitTest({ perms: { env: true } }, function systemCpuInfo(): void { - const { cores, speed } = Deno.systemCpuInfo(); - assert(cores === undefined || cores > 0); - assert(speed === undefined || speed > 0); -}); -- cgit v1.2.3