Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeout handling with --inspect-brk/--inspect #4125

Merged
merged 2 commits into from Dec 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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();
});
});
});