Colorize test result diff output.

This commit is contained in:
Daniel Patterson
2016-03-31 13:25:51 -07:00
parent 23d41d584b
commit 1f18dc300f
2 changed files with 6 additions and 4 deletions
+4 -3
View File
@@ -3,6 +3,7 @@
var util = require('util');
var path = require('path');
var fs = require('fs');
var chalk = require('chalk');
var OSRMError = class extends Error {
constructor (process, code, msg, log, lines) {
@@ -118,9 +119,9 @@ module.exports = {
this.diff.forEach((row) => {
var rowString = '| ';
this.headers.forEach((header) => {
if (!row.c_status) rowString += ' ' + row[header] + ' | ';
else if (row.c_status === 'undefined') rowString += '(-) ' + row[header] + ' | ';
else rowString += '(+) ' + row[header] + ' | ';
if (!row.c_status) rowString += chalk.green(' ' + row[header] + ' | ');
else if (row.c_status === 'undefined') rowString += chalk.yellow('(-) ' + row[header] + ' | ');
else rowString += chalk.red('(+) ' + row[header] + ' | ');
});
s.push(rowString);
});