Skip to content
masterclass Buddy

Jest · Method

jest.doMock

jest.doMock() registers a module mock without the automatic hoisting used by jest.mock() with babel-jest. It is useful when different tests in one file need different mock implementations.

Last updated

Syntax

jest.doMock(moduleName, factory, options?)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • jest.mock
  • jest.resetModules
  • jest.dontMock
  • jest.requireActual

Source: The Jest Object · Jest. Checked 2026-11-03.