Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
Trott committed Jan 14, 2019
commit ea51df362f284d592f6e4df356527c0d3fd103e0
11 changes: 7 additions & 4 deletions test/known_issues/test-vm-timeout-escape-queuemicrotask.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ const NS_PER_MS = 1000000n;

const hrtime = process.hrtime.bigint;

const loopDuration = common.platformTimeout(100n);
const timeout = common.platformTimeout(10);

function loop() {
const start = hrtime();
while (1) {
const current = hrtime();
const span = (current - start) / NS_PER_MS;
if (span >= 100n) {
if (span >= loopDuration) {
throw new Error(
`escaped timeout at ${span} milliseconds!`);
`escaped ${timeout}ms timeout at ${span}ms`);
}
}
}
Expand All @@ -32,9 +35,9 @@ assert.throws(() => {
queueMicrotask,
loop
},
{ timeout: common.platformTimeout(5) }
{ timeout }
);
}, {
code: 'ERR_SCRIPT_EXECUTION_TIMEOUT',
message: 'Script execution timed out after 5ms'
message: `Script execution timed out after ${timeout}ms`
});