Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 697 Bytes

File metadata and controls

27 lines (20 loc) · 697 Bytes
title clearMocks | Config
outline deep

clearMocks

  • 类型: boolean
  • 默认值: false

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

This will clear mock history without affecting mock implementations.

import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    clearMocks: 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 for all mocks, including those currently being used by other tests in progress. :::