☕️ Classic, reliable, trusted test framework for Node.js and the browser
after hooks now being called on failed tests when using bail, fixes #1093
David da Silva607eb922c389
diff --git a/lib/runner.js b/lib/runner.jsindex d12c5cd9..db232125 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -246,7 +246,6 @@ Runner.prototype.hook = function(name, fn){function next(i) {var hook = hooks[i];if (!hook) return fn();- if (self.failures && suite.bail()) return fn();self.currentRunnable = hook;hook.ctx.currentTest = self.test;diff --git a/test/runner.js b/test/runner.jsindex 04cc583d..a11aeeda 100644--- a/test/runner.js+++ b/test/runner.js@@ -181,6 +181,20 @@ describe('Runner', function(){})})+ describe('.hook(name, fn)', function(){+ it('should execute hooks after failed test if suite bail is true', function(done){+ runner.fail({});+ suite.bail(true);+ suite.afterEach(function(){+ suite.afterAll(function() {+ done();+ })+ });+ runner.hook('afterEach', function(){});+ runner.hook('afterAll', function(){});+ })+ })+describe('.fail(test, err)', function(){it('should increment .failures', function(){runner.failures.should.equal(0);