Skip to content

armgit / mocha

Public Imported from GitHub
0

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

tweak list reporter styling

Tj Holowaychuka5d98f4551f0
diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index 6bde55f6..68cc8368 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -35,6 +35,7 @@ exports.colors = {
, 'error title': 0
, 'error message': 31
, 'error stack': 90
+ , 'checkmark': 32
, 'fast': 90
, 'medium': 33
, 'slow': 31
diff --git a/lib/reporters/list.js b/lib/reporters/list.js
index 5cbf6b50..f27af2c6 100644
--- a/lib/reporters/list.js
+++ b/lib/reporters/list.js
@@ -31,10 +31,17 @@ function List(runner) {
console.log();
});
+ // test started
+ runner.on('test', function(test){
+ process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
+ });
+
// test passed
runner.on('pass', function(test){
- var fmt = color('pass', ' %s - ') + color(test.speed, '%dms');
- console.log(fmt, test.fullTitle(), test.duration);
+ var fmt = color('checkmark', ' ✔')
+ + color('pass', ' %s: ')
+ + color(test.speed, '%dms');
+ console.log('\r' + fmt, test.fullTitle(), test.duration);
});
// test failed