Skip to content

armgit / mocha

Public Imported from GitHub
0

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

only write to stdout in reporters

Glen Mailer58f2aca7e388
diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index 6d51fcfd..a5f68d40 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -154,7 +154,7 @@ exports.cursor = {
*/
exports.list = function(failures){
- console.error();
+ console.log();
failures.forEach(function(test, i){
// format
var fmt = color('error title', ' %s) %s:\n')
@@ -200,7 +200,7 @@ exports.list = function(failures){
stack = stack.slice(index ? index + 1 : index)
.replace(/^/gm, ' ');
- console.error(fmt, (i + 1), test.fullTitle(), msg, stack);
+ console.log(fmt, (i + 1), test.fullTitle(), msg, stack);
});
};
@@ -305,11 +305,10 @@ Base.prototype.epilogue = function(){
if (stats.failures) {
fmt = color('fail', ' %d failing');
- console.error(fmt,
- stats.failures);
+ console.log(fmt, stats.failures);
Base.list(this.failures);
- console.error();
+ console.log();
}
console.log();
diff --git a/test/reporters/base.js b/test/reporters/base.js
index e8fe1e63..49d2f168 100644
--- a/test/reporters/base.js
+++ b/test/reporters/base.js
@@ -4,8 +4,8 @@ describe('Base reporter', function () {
it('should show diffs with showDiff property set', function () {
var err = new Error('test'),
- stderr = [],
- stderrWrite = process.stderr.write,
+ stdout = [],
+ stdoutWrite = process.stdout.write,
errOut;
err.actual = "a1";
@@ -18,15 +18,15 @@ describe('Base reporter', function () {
}
};
- process.stderr.write = function (string) {
- stderr.push(string);
+ process.stdout.write = function (string) {
+ stdout.push(string);
};
Base.list([test]);
- process.stderr.write = stderrWrite;
+ process.stdout.write = stdoutWrite;
- errOut = stderr.join('\n');
+ errOut = stdout.join('\n');
errOut.should.match(/test/);
errOut.should.match(/actual/);
@@ -36,8 +36,8 @@ describe('Base reporter', function () {
it('should not show diffs when showDiff property set', function () {
var err = new Error('test'),
- stderr = [],
- stderrWrite = process.stderr.write,
+ stdout = [],
+ stdoutWrite = process.stdout.write,
errOut;
err.actual = "a1";
@@ -50,15 +50,15 @@ describe('Base reporter', function () {
}
};
- process.stderr.write = function (string) {
- stderr.push(string);
+ process.stdout.write = function (string) {
+ stdout.push(string);
};
Base.list([test]);
- process.stderr.write = stderrWrite;
+ process.stdout.write = stdoutWrite;
- errOut = stderr.join('\n');
+ errOut = stdout.join('\n');
errOut.should.match(/test/);
errOut.should.not.match(/actual/);