diff --git a/bin/mocha b/bin/mocha index 4b0ab8ff86..9c63463790 100755 --- a/bin/mocha +++ b/bin/mocha @@ -54,12 +54,14 @@ const trimV8Option = value => Object.keys(opts).forEach(opt => { if (isNodeFlag(opt)) { nodeArgs[trimV8Option(opt)] = opts[opt]; - disableTimeouts(opt); } else { mochaArgs[opt] = opts[opt]; } }); +// disable 'timeout' for debugFlags +Object.keys(nodeArgs).forEach(opt => disableTimeouts(opt)); + // Native debugger handling // see https://nodejs.org/api/debugger.html#debugger_debugger // look for 'inspect' or 'debug' that would launch this debugger, diff --git a/test/integration/fixtures/options/slow-test.fixture.js b/test/integration/fixtures/options/slow-test.fixture.js index f15cb6d9dd..952e656743 100644 --- a/test/integration/fixtures/options/slow-test.fixture.js +++ b/test/integration/fixtures/options/slow-test.fixture.js @@ -5,7 +5,7 @@ describe('a suite', function() { setTimeout(done, 500); }); - it('should succeed in 1.5s', function(done) { - setTimeout(done, 1500); + it('should succeed in 1.1s', function(done) { + setTimeout(done, 1100); }); }); diff --git a/test/integration/options/timeout.spec.js b/test/integration/options/timeout.spec.js index ac786da54d..4470c8b310 100644 --- a/test/integration/options/timeout.spec.js +++ b/test/integration/options/timeout.spec.js @@ -49,4 +49,19 @@ describe('--timeout', function() { done(); }); }); + + it('should disable timeout with --inspect', function(done) { + var fixture = 'options/slow-test'; + runMochaJSON(fixture, ['--inspect', '--timeout', '200'], function( + err, + res + ) { + if (err) { + done(err); + return; + } + expect(res, 'to have passed').and('to have passed test count', 2); + done(); + }); + }); });