feat: colorize checker output

This commit is contained in:
thetek 2024-04-01 17:02:38 +02:00
parent 980feed749
commit 2f2ab1eeb0

View File

@ -195,9 +195,9 @@ for (const msg of SAMPLES) {
const validationResult = validator(msg); const validationResult = validator(msg);
if (validationResult.success) { if (validationResult.success) {
console.log(`msg ${msg.id}: OK`); console.log(`msg ${msg.id}: \x1b[32mOK\x1b[0m`);
} else { } else {
console.log(`msg ${msg.id}: ERROR`); console.log(`msg ${msg.id}: \x1b[31mERROR\x1b[0m`);
for (const error of validationResult.errors) { for (const error of validationResult.errors) {
console.log(` - ${error.path}, expected ${error.expected}, found value ${error.value}`); console.log(` - ${error.path}, expected ${error.expected}, found value ${error.value}`);
} }