Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fixed error listings due to stdout. Closes #17

Tj Holowaychuk3701cf0b6e08
diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index caa4af4f..e77c7434 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -90,7 +90,7 @@ exports.cursor = {
*/
exports.list = function(failures){
- console.log();
+ console.error();
failures.forEach(function(test, i){
// format
var fmt = color('error title', ' %s) %s: ')
@@ -106,7 +106,7 @@ exports.list = function(failures){
stack = stack.slice(index)
.replace(/^/gm, ' ');
- console.log(fmt, i, test.title, msg, stack);
+ console.error(fmt, i, test.title, msg, stack);
});
};
@@ -179,11 +179,11 @@ Base.prototype.epilogue = function(){
// failure
if (stats.failures) {
- console.log(
+ console.error(
color('fail message', ' ✖ %d of %d tests failed')
, stats.failures, stats.tests);
Base.list(this.failures);
- console.log();
+ console.error();
process.nextTick(function(){
process.exit(stats.failures);
});