mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
## Summary Adds a new `--only-failures` flag to `bun test` that only displays test failures, similar to `--dots` but without printing dots for each test. ## Motivation When running large test suites or in CI environments, users often only care about test failures. The existing `--dots` reporter reduces verbosity by showing dots, but still requires visual scanning to find failures. The `--only-failures` flag provides a cleaner output by completely suppressing passing tests. ## Changes - Added `--only-failures` CLI flag in `Arguments.zig` - Added `only_failures` boolean to the test reporters struct in `cli.zig` - Updated test output logic in `test_command.zig` to skip non-failures when flag is set - Updated `jest.zig` and `bun_test.zig` to handle the new flag - Added comprehensive tests in `only-failures.test.ts` ## Usage ```bash bun test --only-failures ``` Example output (only shows failures): ``` test/example.test.ts: (fail) failing test error: expect(received).toBe(expected) Expected: 3 Received: 2 5 pass 1 skip 2 fail Ran 8 tests across 1 file. ``` ## Test Plan - Verified `--only-failures` flag only shows failing tests - Verified normal test output still works without the flag - Verified `--dots` reporter still works correctly - Added regression tests with snapshot comparisons 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: pfg <pfg@pfg.pw>