[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
vitest docs config mockreset.md
700 B


title: mockReset | Config outline: deep #

mockReset #

  • Type: boolean
  • Default: false

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

This will clear mock history and reset each implementation.

import { defineConfig } from 'vitest/config'

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

::: warning Be aware that this option may cause problems with async concurrent tests. If enabled, the completion of one test will clear the mock history and implementation for all mocks, including those currently being used by other tests in progress. :::