Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fixed "test end" event for failures

Tj Holowaychukf59ea2130cc6
diff --git a/lib/runner.js b/lib/runner.js
index a63b9895..caf42d24 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -207,7 +207,10 @@ Runner.prototype.runTests = function(suite, fn){
function next(err) {
// error handling
- if (err) self.fail(test, err);
+ if (err) {
+ self.fail(test, err);
+ self.emit('test end', test);
+ }
// next test
test = tests.shift();
diff --git a/mocha.js b/mocha.js
index eb8813ba..70256bc6 100644
--- a/mocha.js
+++ b/mocha.js
@@ -1615,7 +1615,10 @@ Runner.prototype.runTests = function(suite, fn){
function next(err) {
// error handling
- if (err) self.fail(test, err);
+ if (err) {
+ self.fail(test, err);
+ self.emit('test end', test);
+ }
// next test
test = tests.shift();