Skip to content

Commit bac94e6

Browse files
committed
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.
1 parent 5d27cc1 commit bac94e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
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,20 +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+
if (!exceptions.length) return;
103+
102104
assert.strictEqual(exceptions.length, 1,
103105
'debugger did not pause on exception');
104106
assert.strictEqual(exceptions[0].uncaught, true);
105107
assert.strictEqual(exceptions[0].script.name, testScript);
106108
assert.strictEqual(exceptions[0].sourceLine + 1, throwsOnLine);
107109
asserted = true;
108110
client.reqContinue(assert.ifError);
111+
clearInterval(interval);
109112
}
110113
}

0 commit comments

Comments
 (0)