From 3591ba8578b5eff96c13afc6fdfcf95a96083761 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Thu, 30 Nov 2023 22:06:01 +0900 Subject: fix(ext/node): fix os.freemem (#21347) --- cli/tests/unit_node/os_test.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'cli') diff --git a/cli/tests/unit_node/os_test.ts b/cli/tests/unit_node/os_test.ts index 2d0d3a8c8..54dc375bb 100644 --- a/cli/tests/unit_node/os_test.ts +++ b/cli/tests/unit_node/os_test.ts @@ -289,3 +289,23 @@ Deno.test({ await child.status; }, }); + +Deno.test({ + name: + "os.freemem() is equivalent of Deno.systemMemoryInfo().free except on linux", + ignore: Deno.build.os === "linux", + fn() { + const diff = Math.abs(os.freemem() - Deno.systemMemoryInfo().free); + assert(diff < 10_000); + }, +}); + +Deno.test({ + name: + "os.freemem() is equivalent of Deno.systemMemoryInfo().available on linux", + ignore: Deno.build.os !== "linux", + fn() { + const diff = Math.abs(os.freemem() - Deno.systemMemoryInfo().available); + assert(diff < 10_000); + }, +}); -- cgit v1.2.3