blob: bc74d14c728a22533ab0ac56956d573bdeffc704 [file]
diff --git a/node_modules/karma-mocha/lib/adapter.js b/node_modules/karma-mocha/lib/adapter.js
index 0c8199e442..b459209efa 100644
--- a/node_modules/karma-mocha/lib/adapter.js
+++ b/node_modules/karma-mocha/lib/adapter.js
@@ -168,12 +168,19 @@ var createMochaReporterConstructor = function (tc, pathname) {
test.$assertionErrors = assertionError ? [assertionError] : []
reportTestResult(tc, test)
} else {
- test.$errors.push(isDebugPage ? error : simpleError)
+ test.$errors.push(isDebugPage ? error : simpleError);
+ // Report test results if the test has ended already.
+ // That means mocha stopped execution due to uncaught error
+ // between tests and would not emit another 'test end' event.
+ if (test.$ended) {
+ reportTestResult(tc, test);
+ }
if (assertionError) test.$assertionErrors.push(assertionError)
}
})
runner.on('test end', function (test) {
+ test.$ended = true;
reportTestResult(tc, test)
})
}