Try more aggressive colors.

This commit is contained in:
Richard Moore 2022-04-21 01:55:39 -04:00
parent 92781b56fa
commit a17b249dbf
2 changed files with 7 additions and 3 deletions

@ -47,7 +47,7 @@
"preinstall": "node ./bootstrap-hoist",
"serve-coverage": "python3 -m http.server -d output/lcov-report 8080",
"test": "mocha --reporter ./reporter packages/*/lib/tests/test-*.js",
"test-coverage": "c8 -o output -r lcov -r text mocha --reporter ./reporter packages/*/lib/tests/test-*.js | tee output/summary.txt"
"test-coverage": "c8 -o output -r lcov -r text mocha --no-color --reporter ./reporter packages/*/lib/tests/test-*.js | tee output/summary.txt"
},
"version": "0.0.0"
}

@ -14,7 +14,10 @@ const {
// See: https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color
const disableColor = !(process.stdout.isTTY);
let disableColor = false; //!(process.stdout.isTTY);
process.argv.forEach((arg) => {
if (arg === "--no-color") { disableColor = true; }
});
const Colors = {
"blue": "\x1b[0;34m",
@ -36,8 +39,9 @@ const Colors = {
};
function colorify(text) {
if (disableColor) { return text; }
return unescapeColor(text.replace(/(<([a-z+]+)>)/g, (all, _, color) => {
if (disableColor) { return ""; }
const seq = Colors[color];
if (seq == null) {
console.log("UNKNOWN COLOR:", color);