Skip to content

armgit / mocha

Public Imported from GitHub
0

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

stdout only for now

Tj Holowaychuke4a72d45dcce
diff --git a/Readme.md b/Readme.md
index 5f70664d..bcef9507 100644
--- a/Readme.md
+++ b/Readme.md
@@ -40,7 +40,7 @@ describe('Array', function(){
[ ] CLI
[ ] before callbacks
[ ] after callbacks
- [ ] todo stdout only
+ [√] todo stdout only
[√] nesting
[ ] nested concat titles
[ ] mutation cov etc
diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index e484d1fe..3c7c21fa 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -86,7 +86,7 @@ exports.cursor = {
*/
exports.list = function(failures){
- console.error();
+ console.log();
failures.forEach(function(test, i){
// format
var fmt = color('error title', ' %s) %s: ')
@@ -95,7 +95,7 @@ exports.list = function(failures){
// stack
var stack = test.err.stack.replace(/^/gm, ' ');
- console.error(fmt, i, test.title, test.err.message, stack);
+ console.log(fmt, i, test.title, test.err.message, stack);
});
};
diff --git a/lib/reporters/dot.js b/lib/reporters/dot.js
index d1f7ed74..e06aada1 100644
--- a/lib/reporters/dot.js
+++ b/lib/reporters/dot.js
@@ -47,14 +47,14 @@ function Dot(runner) {
// tests are complete, output some stats
// and the failures if any
runner.on('end', function(){
- console.error('\n');
+ console.log('\n');
if (stats.failures) {
- console.error(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
+ console.log(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
Base.list(self.failures);
} else {
- console.error(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
+ console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
}
- console.error();
+ console.log();
process.exit(stats.failures);
});
}
\ No newline at end of file
diff --git a/lib/reporters/landing.js b/lib/reporters/landing.js
index 5714a3f5..f81c952d 100644
--- a/lib/reporters/landing.js
+++ b/lib/reporters/landing.js
@@ -87,10 +87,10 @@ function Landing(runner) {
cursor.show();
console.log('\n');
if (stats.failures) {
- console.error(color('fail message', ' ✖ %d of the %d passengers didnt make it!'), stats.failures, stats.tests);
+ console.log(color('fail message', ' ✖ %d of the %d passengers didnt make it!'), stats.failures, stats.tests);
Base.list(self.failures);
} else {
- console.error(color('pass message', ' ✔ %d passengers arrived safely in %dms!'), stats.tests, stats.duration);
+ console.log(color('pass message', ' ✔ %d passengers arrived safely in %dms!'), stats.tests, stats.duration);
}
console.log();
process.exit(stats.failures);
diff --git a/lib/reporters/list.js b/lib/reporters/list.js
index de172310..5beed704 100644
--- a/lib/reporters/list.js
+++ b/lib/reporters/list.js
@@ -28,30 +28,30 @@ function List(runner) {
// tests started
runner.on('start', function(){
- console.error();
+ console.log();
});
// test passed
runner.on('pass', function(test){
- console.error(color('pass', ' %s'), test.fullTitle());
+ console.log(color('pass', ' %s'), test.fullTitle());
});
// test failed
runner.on('fail', function(test, err){
- console.error(color('fail', ' %d) %s'), n++, test.fullTitle());
+ console.log(color('fail', ' %d) %s'), n++, test.fullTitle());
});
// tests are complete, output some stats
// and the failures if any
runner.on('end', function(){
- console.error();
+ console.log();
if (stats.failures) {
- console.error(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
+ console.log(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
Base.list(self.failures);
} else {
- console.error(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
+ console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
}
- console.error();
+ console.log();
process.exit(stats.failures);
});
}
\ No newline at end of file
diff --git a/lib/reporters/progress.js b/lib/reporters/progress.js
index 111f220b..4daa5017 100644
--- a/lib/reporters/progress.js
+++ b/lib/reporters/progress.js
@@ -73,12 +73,12 @@ function Progress(runner, options) {
Base.cursor.show();
console.log('\n');
if (stats.failures) {
- console.error(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
+ console.log(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
Base.list(self.failures);
} else {
- console.error(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
+ console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
}
- console.error();
+ console.log();
process.exit(stats.failures);
});
}
\ No newline at end of file