Skip to content

Commit

Permalink
test: increase timeout in break-on-uncaught
Browse files Browse the repository at this point in the history
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 <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
  • Loading branch information
thefourtheye authored and evanlucas committed Jan 31, 2017
1 parent a8533ac commit 0753bc1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/debugger/test-debug-break-on-uncaught.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function runScenario(scriptName, throwsOnLine, next) {
client.connect(port);
}

let interval;
function runTest(client) {
client.req(
{
Expand All @@ -91,20 +92,22 @@ function runScenario(scriptName, throwsOnLine, next) {

client.reqContinue(function(error) {
assert.ifError(error);
setTimeout(assertHasPaused.bind(null, client), 100);
interval = setInterval(assertHasPaused.bind(null, client), 10);
});
}
);
}

function assertHasPaused(client) {
assert(exceptions.length, 'no exceptions thrown, race condition in test?');
if (!exceptions.length) return;

assert.strictEqual(exceptions.length, 1,
'debugger did not pause on exception');
assert.strictEqual(exceptions[0].uncaught, true);
assert.strictEqual(exceptions[0].script.name, testScript);
assert.strictEqual(exceptions[0].sourceLine + 1, throwsOnLine);
asserted = true;
client.reqContinue(assert.ifError);
clearInterval(interval);
}
}

0 comments on commit 0753bc1

Please sign in to comment.