Skip to content

feat(cli): add --retry <n> to re-run failed tests#756

Merged
Chemaclass merged 1 commit into
mainfrom
feat/cli-retry
Jul 10, 2026
Merged

feat(cli): add --retry <n> to re-run failed tests#756
Chemaclass merged 1 commit into
mainfrom
feat/cli-retry

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #737

Flaky tests (timing, network, filesystem races) fail intermittently and poison CI. A bounded retry lets a genuinely-flaky test recover while a consistently-broken one still fails, without hiding real failures.

💡 Changes

  • Add --retry <n> flag and BASHUNIT_RETRY env var; a failed test is re-run up to N extra times and reported passed if any attempt passes. Disabled by default (0).
  • Retry wraps only test execution, so the report/counter path runs once on the final attempt — no double-counting; each --parallel fork retries itself.
  • Tests that only pass after retrying are annotated (retry n/m) so flakiness stays visible; composes with --stop-on-failure.
  • Docs (command-line + configuration) and CHANGELOG updated.

Re-run a failed test up to N extra times (--retry <n> / BASHUNIT_RETRY),
reporting it passed if any attempt passes. Retry wraps only test execution;
the parse/report/counter path runs once on the final attempt, so nothing is
double-counted and each --parallel fork retries itself. Tests that only pass
on retry are annotated '(retry n/m)'. Disabled by default.

Closes #737
@Chemaclass Chemaclass added the enhancement New feature or request label Jul 10, 2026
@Chemaclass Chemaclass self-assigned this Jul 10, 2026
@Chemaclass Chemaclass merged commit 281c485 into main Jul 10, 2026
31 checks passed
@Chemaclass Chemaclass deleted the feat/cli-retry branch July 10, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant