diff --git a/libs/test-utils-vitest/src/console.test.ts b/libs/test-utils-vitest/src/console.test.ts index 32240f138b..3055642f96 100644 --- a/libs/test-utils-vitest/src/console.test.ts +++ b/libs/test-utils-vitest/src/console.test.ts @@ -1,7 +1,14 @@ /* eslint-disable no-console */ -import { expect, test } from 'vitest'; +import { beforeAll, expect, test } from 'vitest'; import { suppressingConsoleOutput } from './console'; +// Ensure that console output suppression is enabled so that we can test it and +// get accurate coverage reporting. E.g. if it's disabled in general in CI for +// other packages, we still want to enable it for these tests. +beforeAll(() => { + process.env['SUPPRESS_CONSOLE_OUTPUT'] = 'true'; +}); + test.each(['log', 'warn', 'error'] as const)( 'suppressingConsoleOutput replaces console.%s with a mock', (method) => {