Skip to content
6 changes: 4 additions & 2 deletions packages/vitest/src/types/mocker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
type Promisable<T> = T | Promise<T>

export type MockFactoryWithHelper<M = unknown> = (
importOriginal: <T extends M>() => Promise<T>
) => any
importOriginal: <T extends M = M>() => Promise<T>
) => Promisable<M | null>
export type MockFactory = () => any

export type MockMap = Map<string, Record<string, string | null | MockFactory>>
Expand Down
1 change: 1 addition & 0 deletions test/config/test/workers-option.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getWorkersCountByPercentage } from 'vitest/src/utils/workers.js'
import * as testUtils from '../../test-utils'

vi.mock(import('node:os'), async importOriginal => ({
...(await importOriginal()),
default: {
...(await importOriginal()).default,
availableParallelism: () => 10,
Expand Down