> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# testTimeout

- **类型：** `number`
- **默认值：** `5_000`（Browser Mode 下为 `15_000`）
- **CLI：** `--testTimeout=5000`

测试的默认超时时间（以毫秒为单位）。设置为 `0` 禁用超时。


**CLI**

```bash
npx rstest --testTimeout=5000
```


**rstest.config.ts**

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

export default defineConfig({
  testTimeout: 5000,
});
```


Rstest 会根据以下优先级顺序确定测试超时时间：

1. 每个测试用例中的 [timeout](/zh/api/runtime-api/test-api/test.md#test-1) 配置
2. 测试文件中通过 [`rs.setConfig({ testTimeout })`](/zh/api/runtime-api/rstest/utilities.md#rssetconfig) 配置的超时时间
3. CLI 中的 `--testTimeout` 选项
4. 配置文件中的 `testTimeout` 选项
5. 默认值 `5000` 毫秒（Browser Mode 下为 `15000` 毫秒）。Browser Mode 下 `expect.poll.timeout` 的默认值也为 `5000` 毫秒，Node Mode 下为 `1000` 毫秒。
