Skip to content
masterclass Buddy

Vitest · Method

vi.isMockFunction

vi.isMockFunction checks whether a value is a Vitest mock function. In TypeScript, a successful check narrows the value to Mock.

Last updated

Syntax

function isMockFunction ( fn: unknown ): asserts fn is Mock

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

Subscribe
  • vi.fn
  • vi.spyOn
  • vi.clearAllMocks
  • vi.resetAllMocks

Source: Vi | Vitest. Checked 2026-11-03.