Vitest · Method
vi.doMock
vi.doMock mocks a module without hoisting the call. The next dynamic import gets the mock, while earlier imports keep the original module.
Last updated
Syntax
function doMock(path: string, factory?: MockOptions | MockFactory<unknown>): Disposable
function doMock<T>(module: Promise<T>, factory?: MockOptions | MockFactory<T>): DisposableIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
vi.mockvi.unmockvi.hoistedvi.importActual