Skip to content

Commit

Permalink
dev-cmd/livecheck: avoid watchlist in test
Browse files Browse the repository at this point in the history
The existing watchlist test in `dev-cmd/livecheck_spec.rb` will only
pass if the testing environment doesn't contain a livecheck watchlist
file. When a watchlist file is present, it ends up being treated as
empty (formulae and casks aren't available in tests) and produces an
`Invalid usage: No formulae or casks to check` error instead. We don't
have to worry about a watchlist file on CI but it's a potential issue
when running `brew test` locally.

This provides a bogus `HOMEBREW_LIVECHECK_WATCHLIST` value to the
`#brew` call, to ensure that any watchlist file in the testing
environment is not used for this test.

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
  • Loading branch information
samford and MikeMcQuaid committed Aug 16, 2023
1 parent e475de2 commit 1d404e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Library/Homebrew/test/dev-cmd/livecheck_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end

it "gives an error when no arguments are given and there's no watchlist", :integration_test do
expect { brew "livecheck" }
expect { brew "livecheck", "HOMEBREW_LIVECHECK_WATCHLIST" => ".this_should_not_exist" }
.to output(/Invalid usage: A watchlist file is required when no arguments are given\./).to_stderr
.and not_to_output.to_stdout
.and be_a_failure
Expand Down

0 comments on commit 1d404e4

Please sign in to comment.