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

View File

@ -47,7 +47,7 @@
"preinstall": "node ./bootstrap-hoist", "preinstall": "node ./bootstrap-hoist",
"serve-coverage": "python3 -m http.server -d output/lcov-report 8080", "serve-coverage": "python3 -m http.server -d output/lcov-report 8080",
"test": "mocha --reporter ./reporter packages/*/lib/tests/test-*.js", "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" "version": "0.0.0"
} }

View File

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