From 99c2a4fd88a56e11e8cc8b5ff11dea3fd208f797 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 11 Apr 2023 02:32:13 +0200 Subject: [PATCH] fix(fancy): improve colors --- src/reporters/fancy.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/reporters/fancy.ts b/src/reporters/fancy.ts index 7cb51a0e..b9f9858e 100644 --- a/src/reporters/fancy.ts +++ b/src/reporters/fancy.ts @@ -9,23 +9,29 @@ import BasicReporter from "./basic"; export const TYPE_COLOR_MAP: { [k in LogType]?: string } = { info: "cyan", fail: "red", + success: "green", + ready: "green", + start: "yellow", }; export const LEVEL_COLOR_MAP: { [k in LogLevel]?: string } = { 0: "red", 1: "yellow", - 2: "white", - 3: "white", }; const unicode = isUnicodeSupported(); const s = (c: string, fallback: string) => (unicode ? c : fallback); -const TYPE_ICONS = { +const TYPE_ICONS: { [k in LogType]?: string } = { + error: s("✖", "×"), + fatal: s("✖", "×"), + ready: s("✔", "√"), + warn: s("⚠", "‼"), info: s("ℹ", "i"), success: s("✔", "√"), debug: s("⚙", "D"), - trace: s("⬆", "T"), + trace: s("→", "→"), fail: s("✖", "×"), + start: s("⚙", "S"), log: "", }; @@ -61,6 +67,7 @@ export default class FancyReporter extends BasicReporter { typeof (TYPE_ICONS as any)[logObj.type] === "string" ? (TYPE_ICONS as any)[logObj.type] : (logObj as any).icon || logObj.type; + return _type ? getColor(typeColor)(_type) : ""; }