Skip to content

fix(cli): reject unknown options instead of silently ignoring them - #872

Merged
Chemaclass merged 1 commit into
mainfrom
fix/reject-unknown-options
Jul 25, 2026
Merged

Chemaclass merged 1 commit into
mainfrom
fix/reject-unknown-options

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #871

The option case in cmd_test and cmd_bench ended in a catch-all that filed any
unmatched argument under test paths. Nothing checked whether the argument looked like
an option, so a mistyped flag was swallowed and the run continued with weaker behaviour
than requested — and exited 0.

💡 Changes

  • Abort with Error: unknown option '<flag>' on stderr and a non-zero exit when an option-shaped argument matches no branch; test paths never start with a dash
  • Covers both test and bench, which had the identical catch-all; the assert subcommand parses its own arguments and is unchanged
  • Add acceptance coverage for the failure modes (--parralel, a typo'd value-taking flag) plus regression guards that a known option and a bare path still work

The option case in cmd_test and cmd_bench ended in a catch-all that filed
any unmatched argument under test paths. Nothing checked whether the
argument looked like an option, so a typo degraded the run and still
exited 0:

  bashunit --parralel tests/        -> ran sequentially, exit 0
  bashunit --filterr foo tests/     -> flag and value swallowed, whole
                                       suite ran, exit 0

In CI that is a green build that never ran the check it was configured
to run. Option-shaped arguments now abort with a message naming the
offending flag; test paths never start with a dash.

The assert subcommand parses its own arguments and is unaffected.

Closes #871
@Chemaclass Chemaclass added the bug Something isn't working label Jul 25, 2026
@Chemaclass Chemaclass self-assigned this Jul 25, 2026
@Chemaclass
Chemaclass merged commit 0c94cdd into main Jul 25, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the fix/reject-unknown-options branch July 25, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant