fix(logger): don't color when running tests

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2552>
This commit is contained in:
Kasper Seweryn 2023-08-14 15:52:54 +02:00 committed by Marge
parent 78be3d8feb
commit fc979983ca
1 changed files with 3 additions and 0 deletions

View File

@ -52,6 +52,9 @@ const getFile = () => {
// NOTE: We're pushing all logs to the end of the event loop // NOTE: We're pushing all logs to the end of the event loop
const createLoggerFn = (level: LogLevel) => { 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[]) => { return (...args: any[]) => {
const timestamp = new Date().toUTCString() const timestamp = new Date().toUTCString()
const { method, file, lineNo } = getFile() const { method, file, lineNo } = getFile()