Skip to content

Commit

Permalink
Fix timeout handling with --inspect-brk/--inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Dec 15, 2019
1 parent aab8555 commit d4adfa6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 3 additions & 1 deletion bin/mocha
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/fixtures/options/slow-test.fixture.js
Expand Up @@ -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);
});
});
15 changes: 15 additions & 0 deletions test/integration/options/timeout.spec.js
Expand Up @@ -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();
});
});
});

0 comments on commit d4adfa6

Please sign in to comment.