Skip to content
GitHub

resetAllMocks

function in meocord/testing Since 4.1.0

resetAllMocks(): void

Clears every mock from meocord/testing, and puts each back to the implementation it was created with.

Use it so every test starts from mocks as they were created: mockReturnValue, mockResolvedValue and the rest a test set are undone, and a mock interaction's methods reply, defer and refuse a second reply as before.

Examples

TypeScript
import { afterEach } from 'vitest'

// In a Vitest setup file
afterEach(() => resetAllMocks())