For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /config/test/clear-mocks.md.
close
  • English
  • 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() before each test.

    CLI
    rstest.config.ts
    npx rstest --clearMocks