Skip to content

fix(test): bail correctly halts current run in watch mode #19918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abelcha
Copy link

@abelcha abelcha commented May 26, 2025

What & Why

Running `bun test --watch --bail N` exited the process after N failures, killing watch mode.

This patch makes bail cooperative in watch mode:

  • When the failure threshold is hit the reporter sets `TestRunner.should_abort`.
  • Execution loops break early; the process stays alive waiting for file changes.
  • Outside watch mode the behaviour is unchanged (still exits non-zero).

Implementation Highlights

  • Added `should_abort` flag to `TestRunner` (renamed from `stop_current_run`).
  • Guard checks inserted in main loops; flag reset each run.
  • Doc-comments and minor DRY clean-ups.

Ready for review 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant