remove colors dependency (#3133)
This commit is contained in:
@@ -28,7 +28,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"acorn": "~5.5.3",
|
"acorn": "~5.5.3",
|
||||||
"colors": "~1.2.5",
|
|
||||||
"semver": "~5.5.0"
|
"semver": "~5.5.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
var colors = require("colors");
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
@@ -39,6 +38,14 @@ function log_titles(log, current, marker) {
|
|||||||
titles = current;
|
titles = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function red(text) {
|
||||||
|
return "\u001B[31m" + text + "\u001B[39m";
|
||||||
|
}
|
||||||
|
|
||||||
|
function green(text) {
|
||||||
|
return "\u001B[32m" + text + "\u001B[39m";
|
||||||
|
}
|
||||||
|
|
||||||
var errors = [];
|
var errors = [];
|
||||||
var total = tasks.length;
|
var total = tasks.length;
|
||||||
titles = [];
|
titles = [];
|
||||||
@@ -54,7 +61,7 @@ process.nextTick(function run() {
|
|||||||
if (elapsed > task.limit) {
|
if (elapsed > task.limit) {
|
||||||
throw new Error("Timed out: " + elapsed + "ms > " + task.limit + "ms");
|
throw new Error("Timed out: " + elapsed + "ms > " + task.limit + "ms");
|
||||||
}
|
}
|
||||||
log_titles(console.log, task.titles, colors.green('\u221A '));
|
log_titles(console.log, task.titles, green('\u221A '));
|
||||||
process.nextTick(run);
|
process.nextTick(run);
|
||||||
};
|
};
|
||||||
if (task.length) {
|
if (task.length) {
|
||||||
@@ -76,19 +83,19 @@ process.nextTick(function run() {
|
|||||||
raise(err);
|
raise(err);
|
||||||
} else if (errors.length) {
|
} else if (errors.length) {
|
||||||
console.error();
|
console.error();
|
||||||
console.log(colors.red(errors.length + " test(s) failed!"));
|
console.log(red(errors.length + " test(s) failed!"));
|
||||||
titles = [];
|
titles = [];
|
||||||
errors.forEach(function(titles, index) {
|
errors.forEach(function(titles, index) {
|
||||||
console.error();
|
console.error();
|
||||||
log_titles(console.error, titles, (index + 1) + ") ");
|
log_titles(console.error, titles, (index + 1) + ") ");
|
||||||
var lines = titles.error.stack.split('\n');
|
var lines = titles.error.stack.split('\n');
|
||||||
console.error(colors.red(lines[0]));
|
console.error(red(lines[0]));
|
||||||
console.error(lines.slice(1).join("\n"));
|
console.error(lines.slice(1).join("\n"));
|
||||||
});
|
});
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
console.log();
|
console.log();
|
||||||
console.log(colors.green(total + " test(s) passed."));
|
console.log(green(total + " test(s) passed."));
|
||||||
}
|
}
|
||||||
|
|
||||||
function raise(err) {
|
function raise(err) {
|
||||||
@@ -96,7 +103,7 @@ process.nextTick(function run() {
|
|||||||
done = function() {};
|
done = function() {};
|
||||||
task.titles.error = err;
|
task.titles.error = err;
|
||||||
errors.push(task.titles);
|
errors.push(task.titles);
|
||||||
log_titles(console.log, task.titles, colors.red('\u00D7 '));
|
log_titles(console.log, task.titles, red('\u00D7 '));
|
||||||
process.nextTick(run);
|
process.nextTick(run);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user