Skip to content

Commit c2a91f2

Browse files
committed
accept and ignore values above TIMEOUT_MAX
1 parent cdbd1b4 commit c2a91f2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/internal/test_runner/test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ class Test extends AsyncResource {
139139
}
140140

141141
if (timeout != null && timeout !== Infinity) {
142-
validateNumber(timeout, 'options.timeout', 0, TIMEOUT_MAX);
143-
this.timeout = timeout;
142+
validateNumber(timeout, 'options.timeout', 0);
143+
if (timeout < TIMEOUT_MAX) {
144+
this.timeout = timeout;
145+
}
144146
}
145147

146148
if (testOnlyFlag && !this.only) {

test/parallel/test-runner-option-validation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const test = require('node:test');
66
[Symbol(), {}, [], () => {}, 1n, true, '1'].forEach((timeout) => {
77
assert.throws(() => test({ timeout }), { code: 'ERR_INVALID_ARG_TYPE' });
88
});
9-
[-1, 2 ** 33, -Infinity, NaN].forEach((timeout) => {
9+
[-1, -Infinity, NaN].forEach((timeout) => {
1010
assert.throws(() => test({ timeout }), { code: 'ERR_OUT_OF_RANGE' });
1111
});
12-
[null, undefined, Infinity, 0, 1, 1.1].forEach((timeout) => {
12+
[null, undefined, Infinity, 0, 1, 1.1, 2 ** 33].forEach((timeout) => {
1313
// Valid values should not throw.
1414
test({ timeout });
1515
});

0 commit comments

Comments
 (0)