> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# restoreMocks

- **类型：** `boolean`
- **默认值：** `false`
- **CLI：** `--restoreMocks`

重置所有 mock，并恢复被 mock 的对象的原始描述符。

当启用 `restoreMocks` 时，rstest 将在每个测试用例执行之前调用 [.restoreAllMocks()](/zh/api/runtime-api/rstest/mock-functions.md#rsrestoreallmocks)。


**CLI**

```bash
npx rstest --restoreMocks
```


**rstest.config.ts**

```ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  restoreMocks: true,
});
```

