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

# bail

- **类型：** `number`
- **默认值：** `0`
- **CLI：** `--bail [number]` (默认值：`1`)

在指定个数的测试失败后中止测试运行。这对于在发生失败时提前停止测试运行非常有用。

将其设置为 `0`（默认值）表示将运行所有测试。将其设置为 `1` 将在第一个测试失败后停止测试运行。


**CLI**

```bash
npx rstest --bail 1
```


**rstest.config.ts**

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

export default defineConfig({
  bail: 1,
});
```

