clearMocks

  • Type: boolean
  • Default: false

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

When clearMocks enabled, rstest will call .clearAllMocks() before each test.

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

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