diff --git a/knip.config.ts b/knip.config.ts index e32756a97..1d22ab1ee 100644 --- a/knip.config.ts +++ b/knip.config.ts @@ -38,6 +38,7 @@ const config: KnipConfig = { 'i18next-parser', 'luxon', // Used in tests 'playwright', // Used in test configs + 'sharp', // Requirement for @vite-pwa/assets-generator 'tsconfig-paths', // Used for e2e test setup 'virtual:pwa-register', // Service Worker code is injected at build time 'virtual:polyfills', // Polyfills are conditionally injected diff --git a/platforms/access-bridge/test/unit/logger.test.ts b/platforms/access-bridge/test/unit/logger.test.ts index a12c386a9..ae20d0d74 100644 --- a/platforms/access-bridge/test/unit/logger.test.ts +++ b/platforms/access-bridge/test/unit/logger.test.ts @@ -4,9 +4,26 @@ import * as Sentry from '@sentry/node'; import logger from '../../src/pipeline/logger.js'; describe('Logger Tests', () => { + // Preserve the original console methods + const originalConsole = { ...console }; + beforeEach(() => { // Reset all mocks to ensure a clean slate for each test vi.resetAllMocks(); + + // Mock console methods to suppress log outputs during tests + // Suppressing info output to avoid clutter + global.console = { + log: () => {}, + error: () => {}, + warn: () => {}, + info: () => {}, + } as unknown as Console; + }); + + afterEach(() => { + // Restore the original console methods after each test + global.console = originalConsole; }); describe('when Sentry is configured', () => { diff --git a/platforms/access-bridge/vite.config.ts b/platforms/access-bridge/vite.config.ts index c671b75ca..a755490e7 100644 --- a/platforms/access-bridge/vite.config.ts +++ b/platforms/access-bridge/vite.config.ts @@ -48,7 +48,7 @@ export default ({ mode, command }: ConfigEnv): UserConfigExport => { }, test: { globals: true, - include: ['**/*.test.ts'], + environment: 'node', setupFiles: 'test/vitest.setup.ts', chaiConfig: { truncateThreshold: 1000,