Skip to content
GitHub

clearAllMocks

function in meocord/testing Since 4.1.0

clearAllMocks(): void

Clears the calls every mock from meocord/testing has recorded, keeping what each was told to do.

Vitest's clearMocks and jest's clearAllMocks() reach only their own vi.fn() and jest.fn() mocks. This one covers createMockFn and everything built on it, such as createMockInteraction and createMockClient. To also undo what a test set, use resetAllMocks.

Examples

TypeScript
import { afterEach } from 'vitest'

afterEach(() => clearAllMocks())