Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve known_issues/test-vm-timeout-escape-queuemicrotask #25503

Closed
wants to merge 1 commit into from
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
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`
});