Skip to content

Commit b5fb9f4

Browse files
thefourtheyeMylesBorins
authored andcommitted
test: increase timeout in break-on-uncaught
As the failures suggest, this test expects the uncaught exception to be thrown within 100 milliseconds, but on some of the test machines it takes longer than that limit to notify the exception. Thats why the test was failing. This patch polls every 10 ms to see if the exception is received. PR-URL: #10822 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
1 parent 443dd50 commit b5fb9f4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

test/debugger/test-debug-break-on-uncaught.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function runScenario(scriptName, throwsOnLine, next) {
7373
client.connect(port);
7474
}
7575

76+
let interval;
7677
function runTest(client) {
7778
client.req(
7879
{
@@ -91,19 +92,22 @@ function runScenario(scriptName, throwsOnLine, next) {
9192

9293
client.reqContinue(function(error) {
9394
assert.ifError(error);
94-
setTimeout(assertHasPaused.bind(null, client), 100);
95+
interval = setInterval(assertHasPaused.bind(null, client), 10);
9596
});
9697
}
9798
);
9899
}
99100

100101
function assertHasPaused(client) {
101-
assert(exceptions.length, 'no exceptions thrown, race condition in test?');
102-
assert.equal(exceptions.length, 1, 'debugger did not pause on exception');
103-
assert.equal(exceptions[0].uncaught, true);
104-
assert.equal(exceptions[0].script.name, testScript);
105-
assert.equal(exceptions[0].sourceLine + 1, throwsOnLine);
102+
if (!exceptions.length) return;
103+
104+
assert.strictEqual(exceptions.length, 1,
105+
'debugger did not pause on exception');
106+
assert.strictEqual(exceptions[0].uncaught, true);
107+
assert.strictEqual(exceptions[0].script.name, testScript);
108+
assert.strictEqual(exceptions[0].sourceLine + 1, throwsOnLine);
106109
asserted = true;
107110
client.reqContinue(assert.ifError);
111+
clearInterval(interval);
108112
}
109113
}

0 commit comments

Comments
 (0)