For AI agents: the complete documentation index is available at https://rstest.rs/zh/llms.txt, the full documentation bundle is available at https://rstest.rs/zh/llms-full.txt, and this page is available as Markdown at https://rstest.rs/zh/config/test/clear-mocks.md.
close
  • 简体中文
  • clearMocks

    • 类型: boolean
    • 默认值: false
    • CLI: --clearMocks

    在每个测试前自动清除所有 mock 的 mock.calls、mock.instances、mock.contexts 和 mock.results 属性。

    启用 clearMocks 后,Rstest 会在每个测试执行前调用 rs.clearAllMocks()。

    CLI
    rstest.config.ts
    npx rstest --clearMocks