From 6c3c9e9ee4020b5bf3b6fa470d859e3e0b24be6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Tue, 11 Oct 2022 02:42:01 -0500 Subject: [PATCH] test: improve test coverage for `os` package --- test/parallel/test-os-process-priority.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/parallel/test-os-process-priority.js b/test/parallel/test-os-process-priority.js index c6fdbff9e554d9..ed8cb3475c33ef 100644 --- a/test/parallel/test-os-process-priority.js +++ b/test/parallel/test-os-process-priority.js @@ -109,6 +109,16 @@ for (let i = PRIORITY_HIGHEST; i <= PRIORITY_LOW; i++) { checkPriority(process.pid, i); } +{ + // From libuv docs + // "The priority value range is between -20 (high priority) and 19 (low priority)" + assert.throws(() => { os.getPriority(-21); }, { + code: 'ERR_SYSTEM_ERROR', + message: 'A system error occurred: uv_os_getpriority returned ESRCH (no such process)', + name: 'SystemError' + }); +} + function checkPriority(pid, expected) { const priority = os.getPriority(pid);