Skip to content

Commit

Permalink
dev-cmd/tests: add --fail-fast.
Browse files Browse the repository at this point in the history
This is useful when testing very slow test files with many tests.
  • Loading branch information
MikeMcQuaid committed Aug 10, 2023
1 parent 62d1ed0 commit 597f084
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Library/Homebrew/dev-cmd/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def tests_args
description: "Enable debugging using byebug."
switch "--changed",
description: "Only runs tests on files that were changed from the master branch."
switch "--fail-fast",
description: "Exit early on the first failing test."
flag "--only=",
description: "Run only <test_script>`_spec.rb`. Appending `:`<line_number> will start at a " \
"specific line."
Expand Down Expand Up @@ -153,6 +155,7 @@ def tests
--color
--require spec_helper
]
bundle_args << "--fail-fast" if args.fail_fast?

# TODO: Refactor and move to extend/os
# rubocop:disable Homebrew/MoveToExtendOS
Expand Down
1 change: 1 addition & 0 deletions completions/bash/brew
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,7 @@ _brew_tests() {
--changed
--coverage
--debug
--fail-fast
--generic
--help
--online
Expand Down
1 change: 1 addition & 0 deletions completions/fish/brew.fish
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@ __fish_brew_complete_arg 'tests' -l byebug -d 'Enable debugging using byebug'
__fish_brew_complete_arg 'tests' -l changed -d 'Only runs tests on files that were changed from the master branch'
__fish_brew_complete_arg 'tests' -l coverage -d 'Generate code coverage reports'
__fish_brew_complete_arg 'tests' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'tests' -l fail-fast -d 'Exit early on the first failing test'
__fish_brew_complete_arg 'tests' -l generic -d 'Run only OS-agnostic tests'
__fish_brew_complete_arg 'tests' -l help -d 'Show this message'
__fish_brew_complete_arg 'tests' -l online -d 'Include tests that use the GitHub API and tests that use any of the taps for official external commands'
Expand Down
1 change: 1 addition & 0 deletions completions/zsh/_brew
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,7 @@ _brew_tests() {
'(--only)--changed[Only runs tests on files that were changed from the master branch]' \
'--coverage[Generate code coverage reports]' \
'--debug[Display any debugging information]' \
'--fail-fast[Exit early on the first failing test]' \
'--generic[Run only OS-agnostic tests]' \
'--help[Show this message]' \
'--online[Include tests that use the GitHub API and tests that use any of the taps for official external commands]' \
Expand Down
2 changes: 2 additions & 0 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,8 @@ Run Homebrew's unit and integration tests.
Enable debugging using byebug.
* `--changed`:
Only runs tests on files that were changed from the master branch.
* `--fail-fast`:
Exit early on the first failing test.
* `--only`:
Run only *`test_script`*`_spec.rb`. Appending `:`*`line_number`* will start at a specific line.
* `--seed`:
Expand Down
4 changes: 4 additions & 0 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -2274,6 +2274,10 @@ Enable debugging using byebug\.
Only runs tests on files that were changed from the master branch\.
.
.TP
\fB\-\-fail\-fast\fR
Exit early on the first failing test\.
.
.TP
\fB\-\-only\fR
Run only \fItest_script\fR\fB_spec\.rb\fR\. Appending \fB:\fR\fIline_number\fR will start at a specific line\.
.
Expand Down

0 comments on commit 597f084

Please sign in to comment.