> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 使用 Bun 测试运行器提前中止

使用 `--bail` 参数在遇到一次失败后中止测试运行。这在持续集成环境中尽早中止测试非常有用。

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun test --bail
```

***

要在达到一定失败次数后中止，可以在参数后选择性地指定数字。

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
# 在失败达到 10 次后中止
bun test --bail=10
```

***

完整的 `bun test` 文档，请参见 [文档 > 测试运行器](/test)。
