Repository navigation
fix(cli): reject unknown options instead of silently ignoring them - #872
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 Background
Related #871
The option
caseincmd_testandcmd_benchended in a catch-all that filed anyunmatched 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
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 dashtestandbench, which had the identical catch-all; theassertsubcommand parses its own arguments and is unchanged--parralel, a typo'd value-taking flag) plus regression guards that a known option and a bare path still work