[minor] Nicer output from test runner

This commit is contained in:
Maciej Małecki 2011-11-01 02:00:21 +01:00
parent 38bd906f2b
commit 5c3d41bf4e

View File

@ -45,8 +45,9 @@ function runTest(test, callback) {
child.on('exit', function (exitCode) { child.on('exit', function (exitCode) {
clearTimeout(killTimeout); clearTimeout(killTimeout);
console.log(' ' + ((exitCode) ? '✘'.red : '✔'.green) + ' ' + console.log(' ' + ((exitCode) ? '✘'.red : '✔'.green) + ' ' +
path.basename(test) + (exitCode && ' (exit code: ' + exitCode + ')')); path.basename(test) +
(exitCode ? (' (exit code: ' + exitCode + ')') : ''));
results[test] = { exitCode: exitCode }; results[test] = { exitCode: exitCode };
callback(); callback();
// //
@ -68,13 +69,14 @@ if (!tests.length) {
// //
} }
console.log('Running tests:'.bold);
async.forEachSeries(tests, runTest, function () { async.forEachSeries(tests, runTest, function () {
var failed = [], ok = []; var failed = [], ok = [];
for (var test in results) { for (var test in results) {
(results[test].exitCode != 0 ? failed : ok).push(test); (results[test].exitCode != 0 ? failed : ok).push(test);
} }
console.log('\nSummary:'); console.log('\nSummary:'.bold);
console.log((' ' + ok.length + '\tpassed tests').green); console.log((' ' + ok.length + '\tpassed tests').green);
console.log((' ' + failed.length + '\tfailed tests').red); console.log((' ' + failed.length + '\tfailed tests').red);
}); });