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

# 使用 Bun 测试运行器及早退出

使用 `--bail` 标志在第一次失败时中止测试运行，这样持续集成运行就能尽早失败。

```sh terminal icon="terminal" theme={null}
bun test --bail
```

***

要在一定数量的失败后退出，请在标志后传入一个数字。

```sh terminal icon="terminal" theme={null}
# 10 次失败后退出
bun test --bail=10
```

***

参见 [`bun test`](/test)。
