test: ensure that test priority is not higher than current priority

PR-URL: https://github.com/nodejs/node/pull/55739
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Livia Medeiros authored and GitHub committed 2024-11-08 10:39:11 +00:00
1 parent 765f16c442
commit a094a8166c
1 file changed
+4 -3
+4 -3
View File
@@ -83,11 +83,12 @@ assert.ok(hostname.length > 0);
// IBMi process priority is different.
if (!common.isIBMi) {
const DUMMY_PRIORITY = 10;
os.setPriority(DUMMY_PRIORITY);
const { PRIORITY_BELOW_NORMAL, PRIORITY_LOW } = os.constants.priority;
const LOWER_PRIORITY = os.getPriority() > PRIORITY_BELOW_NORMAL ? PRIORITY_BELOW_NORMAL : PRIORITY_LOW;
os.setPriority(LOWER_PRIORITY);
const priority = os.getPriority();
is.number(priority);
assert.strictEqual(priority, DUMMY_PRIORITY);
assert.strictEqual(priority, LOWER_PRIORITY);
}
// On IBMi, os.uptime() returns 'undefined'