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

# clearMocks

- **Type:** `boolean`
- **Default:** `false`
- **CLI:** `--clearMocks`

Automatically clear mock calls, instances, contexts and results before every test.

When `clearMocks` enabled, rstest will call [.clearAllMocks()](/api/runtime-api/rstest/mock-functions.md#rsclearallmocks) before each test.


**CLI**

```bash
npx rstest --clearMocks
```


**rstest.config.ts**

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

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

