Colorize test result diff output.

This commit is contained in:
Daniel Patterson 2016-03-31 13:25:51 -07:00 committed by Patrick Niklaus
parent cbc8b64854
commit 497da1d29b
2 changed files with 6 additions and 4 deletions

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);
});

View File

@ -8,7 +8,8 @@
"d3-queue": "^2.0.3",
"node-timeout": "0.0.4",
"request": "^2.69.0",
"xmlbuilder": "^4.2.1"
"xmlbuilder": "^4.2.1",
"chalk": "^1.1.3"
},
"bin": {
"cucumber": "./node_modules/cucumber/bin/cucumber.js"