Skip to content

feat(cli): --order-by to run the last run's failures first - #1039

Merged
Chemaclass merged 1 commit into
mainfrom
feat/1011-order-by-defects
Aug 10, 2026
Merged

feat(cli): --order-by to run the last run's failures first#1039
Chemaclass merged 1 commit into
mainfrom
feat/1011-order-by-defects

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1011

--rerun-failed replays the recorded failures and drops everything else. That is the right tool while fixing one failure, and the wrong one for CI or the final check before pushing, where you want the full suite with the known-bad tests first.

💡 Changes

  • --order-by <mode> picks the execution order: defined (default), defects or random.
  • defects reads the same .bashunit/last-failed cache as --rerun-failed but reorders instead of narrowing, so the whole suite still runs. Paired with --stop-on-failure it fails in seconds instead of minutes.
  • With no cache the order falls back to defined. An unknown mode exits non-zero listing the valid ones.
  • --random-order and --seed keep working unchanged; --order-by random is the same mode under the new name.

--rerun-failed replays the recorded failures and drops everything else,
which is the wrong tool for CI and for the final check before pushing.
There you want the whole suite, just with the known-bad tests first, so
--stop-on-failure trips in seconds instead of minutes.

--order-by defects reads the same .bashunit/last-failed cache but
reorders instead of narrowing: recorded files lead the file list and
recorded functions lead their file, both in the order the cache holds
them, and everything else follows unchanged. With no cache the order
falls back to defined.

defined names the current behaviour so it can be set explicitly, and
random is the existing --random-order under the new flag. Both spellings
stay live because either can arrive through the environment rather than
the parser, so is_random_order_enabled accepts each.

Closes #1011
@Chemaclass Chemaclass added the enhancement New feature or request label Aug 10, 2026
@Chemaclass Chemaclass self-assigned this Aug 10, 2026
@Chemaclass
Chemaclass merged commit 1b6b31f into main Aug 10, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the feat/1011-order-by-defects branch August 10, 2026 13:21
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