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/hook-timeout.md.
close
  • 简体中文
  • hookTimeout

    • 类型: number
    • 默认值: 10_000
    • CLI: --hookTimeout=10000

    生命周期 Hook(beforeAll、afterAll、beforeEach、afterEach、onTestFinished 和 onTestFailed)的默认超时时间(毫秒)。设为 0 表示禁用超时。

    CLI
    rstest.config.ts
    npx rstest --hookTimeout=10000

    Rstest 按以下优先级确定 Hook 超时时间:

    1. 单个 Hook 中传入的 timeout 参数
    2. 测试文件中通过 rs.setConfig({ hookTimeout }) 设置的超时时间
    3. CLI 的 --hookTimeout 选项
    4. 配置文件中的 hookTimeout 选项
    5. 默认值 10_000 毫秒