Skip to content

Commit b5ac468

Browse files
committed
chore: mock tinyrainbow in tests to never print colors
1 parent 561de85 commit b5ac468

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/test-utils/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,21 @@ import { Readable, Writable } from 'node:stream'
88
import { fileURLToPath } from 'node:url'
99
import { dirname, resolve } from 'pathe'
1010
import { x } from 'tinyexec'
11-
import { afterEach, onTestFinished, type WorkerGlobalState } from 'vitest'
11+
import { afterEach, onTestFinished, vi, type WorkerGlobalState } from 'vitest'
1212
import { startVitest } from 'vitest/node'
1313
import { getCurrentTest } from 'vitest/suite'
1414
import { Cli } from './cli'
1515

16+
vi.mock('tinyrainbow', async (importOriginal) => {
17+
const { getDefaultColors, createColors, isSupported } = await importOriginal<any>()
18+
return {
19+
default: getDefaultColors(),
20+
getDefaultColors,
21+
createColors,
22+
isSupported,
23+
}
24+
})
25+
1626
interface VitestRunnerCLIOptions {
1727
std?: 'inherit'
1828
fails?: boolean

0 commit comments

Comments
 (0)