Skip to content

Commit

Permalink
test: fix flaky test-vm-timeout-escape-nexttick
Browse files Browse the repository at this point in the history
PR-URL: #28461
Fixes: #24120
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and targos committed Jul 2, 2019
1 parent 3f6f968 commit 8a64b70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 0 additions & 2 deletions test/known_issues/known_issues.status
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ test-vm-timeout-escape-promise: PASS,FLAKY
[$system==aix]

[$arch==arm]
# https://github.com/nodejs/node/issues/24120
test-vm-timeout-escape-nexttick: PASS,FLAKY
30 changes: 17 additions & 13 deletions test/known_issues/test-vm-timeout-escape-nexttick.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,20 @@ function loop() {
}
}

assert.throws(() => {
vm.runInNewContext(
'nextTick(loop); loop();',
{
hrtime,
nextTick,
loop
},
{ timeout: common.platformTimeout(10) }
);
}, {
code: 'ERR_SCRIPT_EXECUTION_TIMEOUT'
});
// The bug won't happen 100% reliably so run the test a small number of times to
// make sure we catch it if the bug exists.
for (let i = 0; i < 4; i++) {
assert.throws(() => {
vm.runInNewContext(
'nextTick(loop); loop();',
{
hrtime,
nextTick,
loop
},
{ timeout: common.platformTimeout(10) }
);
}, {
code: 'ERR_SCRIPT_EXECUTION_TIMEOUT'
});
}

0 comments on commit 8a64b70

Please sign in to comment.