For AI agents: the complete documentation index is available at https://rstest.rs/llms.txt, the full documentation bundle is available at https://rstest.rs/llms-full.txt, and this page is available as Markdown at https://rstest.rs/config/test/restore-mocks.md.
close
  • English
  • restoreMocks

    • Type: boolean
    • Default: false
    • CLI: --restoreMocks

    Restore object methods replaced by rs.spyOn() before every test. Mock call history and implementations remain unchanged, and standalone mocks created with rs.fn() are not affected.

    When restoreMocks enabled, rstest will call .restoreAllMocks() before each test.

    CLI
    rstest.config.ts
    npx rstest --restoreMocks