Skip to content
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
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);
}
}