Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

prevent hooks from being called if we are bailing

Alexander Early3f2d701ae57b
diff --git a/lib/runner.js b/lib/runner.js
index 43698089..9f6fdc07 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -232,6 +232,7 @@ 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;
self.emit('hook', hook);