diff --git a/.gitignore b/.gitignore index 29db8f57101ae..7941b6dee2a35 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ /Library/Taps /Library/PinnedTaps /Library/Homebrew/.byebug_history +/Library/Homebrew/test/.rdbg_history # Ignore Bundler files **/.bundle/bin diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index d8c6c62ded525..9050ace4e4745 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -21,6 +21,8 @@ class Tests < AbstractCommand switch "--online", description: "Include tests that use the GitHub API and tests that use any of the taps for " \ "official external commands." + switch "--debug", + description: "Enable debugging using ruby/debug." switch "--changed", description: "Only runs tests on files that were changed from the master branch." switch "--fail-fast", @@ -43,6 +45,8 @@ def run # Given we might be testing various commands, we probably want everything (except sorbet-static) Homebrew.install_bundler_gems!(groups: Homebrew.valid_gem_groups - ["sorbet"]) + require "debug" if args.debug? + HOMEBREW_LIBRARY_PATH.cd do setup_environment! diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index ba08b3bac1389..2de31df22eb4d 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -29,6 +29,7 @@ require "rspec/sorbet" require "rubocop/rspec/support" require "find" +require "debug" require "timeout" $LOAD_PATH.unshift(File.expand_path("#{ENV.fetch("HOMEBREW_LIBRARY")}/Homebrew/test/support/lib")) @@ -229,14 +230,14 @@ @__stdin = $stdin.clone begin - if !example.metadata.keys.intersect?([:focus, :byebug]) && !ENV.key?("HOMEBREW_VERBOSE_TESTS") + if !example.metadata.keys.include?(:focus) && !ENV.key?("HOMEBREW_VERBOSE_TESTS") $stdout.reopen(File::NULL) $stderr.reopen(File::NULL) + $stdin.reopen(File::NULL) else - # don't retry when focusing/debugging + # don't retry when focusing config.default_retry_count = 0 end - $stdin.reopen(File::NULL) begin timeout = example.metadata.fetch(:timeout, 60)