mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
## Summary This PR adds support for the `--pass-with-no-tests` CLI flag to the test runner, addressing issue #20814. With the latest v1.2.8 release, the test runner now fails when no tests match a filter. While this is useful for agentic coding workflows, there are legitimate cases where the previous behavior is preferred, such as in monorepos where a standard test file pattern is used as a filter but not all packages contain tests. This flag makes the test runner behave like Jest and Vitest, exiting with code 0 when no tests are found. ## Changes - Added `--pass-with-no-tests` flag to CLI arguments in `src/cli/Arguments.zig` - Added `pass_with_no_tests` field to `TestOptions` struct in `src/cli.zig` - Updated test runner logic in `src/cli/test_command.zig` to respect the flag - Added comprehensive tests in `test/cli/test/pass-with-no-tests.test.ts` ## Test Plan All new tests pass: - ✅ `--pass-with-no-tests` exits with 0 when no test files found - ✅ `--pass-with-no-tests` exits with 0 when filters match no tests - ✅ Without flag, still exits with 1 when no tests found (preserves existing behavior) - ✅ `--pass-with-no-tests` still fails when actual tests fail Closes #20814 🤖 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>