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 uncaught TypeError if error occurs on next tick, closes #2315 #2439

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ Runner.prototype.runTest = function(fn) {
var self = this;
var test = this.test;

if (!test) {
return;
}
if (this.asyncOnly) {
test.asyncOnly = true;
}
Expand Down
7 changes: 7 additions & 0 deletions test/integration/fixtures/regression/issue-2315.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('issue-2315: cannot read property currentRetry of undefined', function () {
before(function () {
require('http').createServer().listen(1);
});

it('something', function () {});
});
13 changes: 12 additions & 1 deletion test/integration/regression.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var assert = require('assert');
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var run = require('./helpers').runMocha;
Expand Down Expand Up @@ -62,6 +62,17 @@ describe('regressions', function() {
});
});

it('issue-2315: cannot read property currentRetry of undefined', function (done) {
runJSON('regression/issue-2315.js', [], function(err, res) {
assert(!err);
assert.equal(res.stats.pending, 0);
assert.equal(res.stats.passes, 0);
assert.equal(res.stats.failures, 1);
assert.equal(res.code, 1);
done();
});
});

it('issue-2406: should run nested describe.only suites', function(done) {
this.timeout(2000);
runJSON('regression/issue-2406.fixture.js', [], function(err, res) {
Expand Down