用途:使用 Bun 内置测试运行器执行测试,并输出经过优化的紧凑结果,适合在智能体流程中快速获取反馈。
主要能力:支持按测试文件或名称模式运行;支持 --coverage 覆盖率报告、--bail 首次失败即停止、--watch 监听模式,以及通过 --reporter=junit --reporter-outfile=junit.xml 输出 JUnit XML 供 CI 使用。
使用方式:默认快速反馈命令为 bun test --dots --bail=1 $PATTERN;带覆盖率用 bun test --dots --coverage $PATTERN;按测试名筛选用 bun test --dots --bail=1 -t "pattern";监听模式用 bun test --watch $PATTERN;CI 模式用 bun test --reporter=junit --reporter-outfile=junit.xml $PATTERN。输出符号含义:. 通过、F 失败、S 跳过。测试后需报告通过/失败汇总,若有失败展示首个失败详情,若启用覆盖率则报告覆盖率百分比。
适用场景:快速运行测试、运行特定文件或模式、带覆盖率运行、CI 中生成 JUnit 报告。
限制:详细配置测试运行器选项应改用 bun-development;交互式调试失败测试应改用 typescript-debugging。