diff options
author | Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com> | 2017-01-16 00:32:32 +0530 |
---|---|---|
committer | Myles Borins <myles.borins@gmail.com> | 2017-03-08 17:11:09 -0800 |
commit | b5fb9f4098917feed72a951270b4bee2a42d6545 (patch) | |
tree | 00db145fd83a032b05f3dc93a38475a2586d8844 /test | |
parent | 443dd508d2401582b0f151573e2e7bbbbc7dd47c (diff) | |
download | node-new-b5fb9f4098917feed72a951270b4bee2a42d6545.tar.gz |
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: https://github.com/nodejs/node/pull/10822
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/debugger/test-debug-break-on-uncaught.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/debugger/test-debug-break-on-uncaught.js b/test/debugger/test-debug-break-on-uncaught.js index dc380fa019..cfe72bb67b 100644 --- a/test/debugger/test-debug-break-on-uncaught.js +++ b/test/debugger/test-debug-break-on-uncaught.js @@ -73,6 +73,7 @@ function runScenario(scriptName, throwsOnLine, next) { client.connect(port); } + let interval; function runTest(client) { client.req( { @@ -91,19 +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?'); - assert.equal(exceptions.length, 1, 'debugger did not pause on exception'); - assert.equal(exceptions[0].uncaught, true); - assert.equal(exceptions[0].script.name, testScript); - assert.equal(exceptions[0].sourceLine + 1, throwsOnLine); + 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); } } |