test: fix incorrect assumptions on uid and gid
Add a invalidArgTypeErrorCount variable to adjust the number of expected errors if the uid and gid options cannot be properly validated. Fixes: https://github.com/nodejs/node/issues/19371 PR-URL: https://github.com/nodejs/node/pull/19554 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
parent
37db277bb4
commit
42c740212d
@ -5,13 +5,15 @@ const spawnSync = require('child_process').spawnSync;
|
||||
const signals = process.binding('constants').os.signals;
|
||||
|
||||
let invalidArgTypeError;
|
||||
let invalidArgTypeErrorCount = 62;
|
||||
|
||||
if (common.isWindows) {
|
||||
invalidArgTypeError =
|
||||
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 42);
|
||||
} else {
|
||||
invalidArgTypeError =
|
||||
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 62);
|
||||
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError },
|
||||
invalidArgTypeErrorCount);
|
||||
}
|
||||
|
||||
const invalidRangeError =
|
||||
@ -76,6 +78,9 @@ if (!common.isWindows) {
|
||||
fail('uid', Infinity, invalidArgTypeError);
|
||||
fail('uid', 3.1, invalidArgTypeError);
|
||||
fail('uid', -3.1, invalidArgTypeError);
|
||||
} else {
|
||||
//Decrement invalidArgTypeErrorCount if validation isn't possible
|
||||
invalidArgTypeErrorCount -= 10;
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,6 +100,9 @@ if (!common.isWindows) {
|
||||
fail('gid', Infinity, invalidArgTypeError);
|
||||
fail('gid', 3.1, invalidArgTypeError);
|
||||
fail('gid', -3.1, invalidArgTypeError);
|
||||
} else {
|
||||
//Decrement invalidArgTypeErrorCount if validation isn't possible
|
||||
invalidArgTypeErrorCount -= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user