Skip to content

Commit 0b1a9aa

Browse files
Trottaddaleax
authored andcommitted
test: improve known_issues/test-vm-timeout-escape-queuemicrotask
Improve known_issues/test-vm-timeout-escape-queuemicrotask to mitigate CI failures on ubuntu1604-arm64. Failures are due to a race condition. Use `common.platformTimeout()` to help, adjust timeout to make sure `queueMicrotasks()` has a chance to run, and improve error message. PR-URL: #25503 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Coe <[email protected]>
1 parent 736349c commit 0b1a9aa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/known_issues/test-vm-timeout-escape-queuemicrotask.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ const NS_PER_MS = 1000000n;
1212

1313
const hrtime = process.hrtime.bigint;
1414

15+
const loopDuration = common.platformTimeout(100n);
16+
const timeout = common.platformTimeout(10);
17+
1518
function loop() {
1619
const start = hrtime();
1720
while (1) {
1821
const current = hrtime();
1922
const span = (current - start) / NS_PER_MS;
20-
if (span >= 100n) {
23+
if (span >= loopDuration) {
2124
throw new Error(
22-
`escaped timeout at ${span} milliseconds!`);
25+
`escaped ${timeout}ms timeout at ${span}ms`);
2326
}
2427
}
2528
}
@@ -32,9 +35,9 @@ assert.throws(() => {
3235
queueMicrotask,
3336
loop
3437
},
35-
{ timeout: common.platformTimeout(5) }
38+
{ timeout }
3639
);
3740
}, {
3841
code: 'ERR_SCRIPT_EXECUTION_TIMEOUT',
39-
message: 'Script execution timed out after 5ms'
42+
message: `Script execution timed out after ${timeout}ms`
4043
});

0 commit comments

Comments
 (0)