Skip to content

Commit 42c7402

Browse files
garwahlgireeshpunathil
authored andcommitted
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: nodejs#19371 PR-URL: nodejs#19554 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
1 parent 37db277 commit 42c7402

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/parallel/test-child-process-spawnsync-validation-errors.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ const spawnSync = require('child_process').spawnSync;
55
const signals = process.binding('constants').os.signals;
66

77
let invalidArgTypeError;
8+
let invalidArgTypeErrorCount = 62;
89

910
if (common.isWindows) {
1011
invalidArgTypeError =
1112
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 42);
1213
} else {
1314
invalidArgTypeError =
14-
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 62);
15+
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError },
16+
invalidArgTypeErrorCount);
1517
}
1618

1719
const invalidRangeError =
@@ -76,6 +78,9 @@ if (!common.isWindows) {
7678
fail('uid', Infinity, invalidArgTypeError);
7779
fail('uid', 3.1, invalidArgTypeError);
7880
fail('uid', -3.1, invalidArgTypeError);
81+
} else {
82+
//Decrement invalidArgTypeErrorCount if validation isn't possible
83+
invalidArgTypeErrorCount -= 10;
7984
}
8085
}
8186

@@ -95,6 +100,9 @@ if (!common.isWindows) {
95100
fail('gid', Infinity, invalidArgTypeError);
96101
fail('gid', 3.1, invalidArgTypeError);
97102
fail('gid', -3.1, invalidArgTypeError);
103+
} else {
104+
//Decrement invalidArgTypeErrorCount if validation isn't possible
105+
invalidArgTypeErrorCount -= 10;
98106
}
99107
}
100108
}

0 commit comments

Comments
 (0)