From 33d7308cfa35d7df6452bc4f65a7c3cbfcd47683 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sun, 1 Mar 2026 04:15:26 +0100 Subject: [PATCH] Fix tests --- common/src/logger.ts | 2 +- {web => common}/tests/unit/logger.test.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) rename {web => common}/tests/unit/logger.test.ts (97%) diff --git a/common/src/logger.ts b/common/src/logger.ts index 5a164b84..169b76e5 100644 --- a/common/src/logger.ts +++ b/common/src/logger.ts @@ -71,7 +71,7 @@ export function logPageView(path: string): void { } const currentLevel = (): LogLevel => { - if (IS_PROD) return 'info' + if (IS_PROD || process.env.NODE_ENV == 'production') return 'info' return 'debug' } diff --git a/web/tests/unit/logger.test.ts b/common/tests/unit/logger.test.ts similarity index 97% rename from web/tests/unit/logger.test.ts rename to common/tests/unit/logger.test.ts index 4f2a6689..5295c5b6 100644 --- a/web/tests/unit/logger.test.ts +++ b/common/tests/unit/logger.test.ts @@ -1,4 +1,4 @@ -import {logApiError, logger} from 'common/lib/logger' +import {logApiError, logger} from 'common/logger' describe('logger', () => { const originalEnv = process.env.NODE_ENV @@ -48,6 +48,7 @@ describe('logger', () => { it('logs debug messages only in development', () => { process.env.NODE_ENV = 'production' + const consoleSpy = jest.spyOn(console, 'debug').mockImplementation(() => {}) logger.debug('Debug message')