☕️ Classic, reliable, trusted test framework for Node.js and the browser
Merge branch 'fix-1417-multiple-done-calls' of https://github.com/frankleonrose/mocha into pull/2059
Christopher Hillera40f28d0328c
diff --cc test/integration/regression.spec.jsindex f2a435a3,31ddd6ea..8b6f49af--- a/test/integration/regression.spec.js+++ b/test/integration/regression.spec.js@@@ -50,48 -52,21 +50,66 @@@ describe('regressions', function()});})+ describe('issue-2286: after doesn\'t execute if test was skipped in beforeEach', function () {+ var afterWasRun = false;+ describe('suite with skipped test for meta test', function () {+ beforeEach(function () { this.skip(); });+ after(function () { afterWasRun = true; });+ it('should be pending', function () {});+ })+ after('meta test', function () {+ afterWasRun.should.be.ok();+ });+ });++ 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) {+ assert(!err);+ assert.equal(res.stats.pending, 0);+ assert.equal(res.stats.passes, 2);+ assert.equal(res.stats.failures, 0);+ assert.equal(res.code, 0);+ done();+ });+ });++ it('issue-2417: should not recurse infinitely with .only suites nested within each other', function() {+ runJSON('regression/issue-2417.fixture.js', [], function(err, res) {+ assert(!err);+ assert.equal(res.stats.pending, 0);+ assert.equal(res.stats.passes, 1);+ assert.equal(res.stats.failures, 0);+ assert.equal(res.code, 0);+ });+ });+++ it('issue-1417 uncaught exceptions from async specs', function(done) {+ runJSON('regression/issue-1417.js', [], function(err, res) {+ assert(!err);+ assert.equal(res.stats.pending, 0);+ assert.equal(res.stats.passes, 0);+ assert.equal(res.stats.failures, 2);++ assert.equal(res.failures[0].title,+ 'fails exactly once when a global error is thrown synchronously and done errors');+ assert.equal(res.failures[0].err.message, 'sync error');+ assert.equal(res.failures[1].title,+ 'fails exactly once when a global error is thrown synchronously and done completes');+ assert.equal(res.failures[1].err.message, 'sync error');+ assert.equal(res.code, 2);+ done();+ });+ });});