From fc979983ca9805e8404ac2e771edb82c5d889c63 Mon Sep 17 00:00:00 2001 From: Kasper Seweryn Date: Mon, 14 Aug 2023 15:52:54 +0200 Subject: [PATCH] fix(logger): don't color when running tests Part-of: --- front/src/composables/useLogger.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/front/src/composables/useLogger.ts b/front/src/composables/useLogger.ts index 169bc7867..e98c54718 100644 --- a/front/src/composables/useLogger.ts +++ b/front/src/composables/useLogger.ts @@ -52,6 +52,9 @@ const getFile = () => { // NOTE: We're pushing all logs to the end of the event loop const createLoggerFn = (level: LogLevel) => { + // NOTE: We don't want to handle logs ourselves in tests + if (import.meta.env.VITEST) return console[level] + return (...args: any[]) => { const timestamp = new Date().toUTCString() const { method, file, lineNo } = getFile()