Skip to content

Commit

Permalink
fix: fix uncaught TypeError if error occurs on next tick, closes #2315
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Sorin committed Sep 19, 2016
1 parent 3a2dae8 commit 7a81a4f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
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

0 comments on commit 7a81a4f

Please sign in to comment.