Skip to content

Commit

Permalink
test: improve test coverage for os package
Browse files Browse the repository at this point in the history
  • Loading branch information
juanarbol committed Oct 11, 2022
1 parent 6831e2f commit 6c3c9e9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/parallel/test-os-process-priority.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6c3c9e9

Please sign in to comment.