Skip to content
masterclass Buddy

Vitest · Method

vi.clearAllMocks

Clears the recorded history of all mocks and spies without changing their implementations. Vitest can also run it automatically before each test when clearMocks is enabled.

Last updated

Syntax

vi.clearAllMocks(): Vitest

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

Subscribe
  • vi.resetAllMocks
  • vi.restoreAllMocks
  • vi.fn
  • vi.spyOn

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