mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
24 lines
473 B
Markdown
24 lines
473 B
Markdown
---
|
|
title: restoreMocks | Config
|
|
outline: deep
|
|
---
|
|
|
|
# restoreMocks
|
|
|
|
- **Type:** `boolean`
|
|
- **Default:** `false`
|
|
|
|
Should Vitest automatically call [`vi.restoreAllMocks()`](/api/vi#vi-restoreallmocks) before each test.
|
|
|
|
This restores all original implementations on spies created manually with [`vi.spyOn`](/api/vi#vi-spyon).
|
|
|
|
```js [vitest.config.js]
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
restoreMocks: true,
|
|
},
|
|
})
|
|
```
|