Skip to content

restoreMocks

  • Type: boolean
  • Default: false

Should Vitest automatically call vi.restoreAllMocks() before each test.

This restores all original implementations on spies created manually with vi.spyOn.

vitest.config.js
js
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    restoreMocks: true,
  },
})

Released under the MIT License.