Fix incompatibility with rake 13.4+ verbose mode#13
Open
ogajduse wants to merge 1 commit intoci-reporter:masterfrom
Open
Fix incompatibility with rake 13.4+ verbose mode#13ogajduse wants to merge 1 commit intoci-reporter:masterfrom
ogajduse wants to merge 1 commit intoci-reporter:masterfrom
Conversation
Rake 13.4.0 (PR ruby/rake#394) introduced verbose console support by setting ENV["TESTOPTS"] = "-v". Rake 13.4.2 (PR ruby/rake#723) fixed this to preserve existing TESTOPTS values and append -v only when not present. However, ci_reporter_test_unit was adding the test_unit_loader.rb file path to TESTOPTS, which caused conflicts: 1. Before rake 13.4.2: TESTOPTS was overwritten, breaking ci_reporter 2. After rake 13.4.2: TESTOPTS preserved, but appending -v caused rake_test_loader to interpret the loader file as a test file, resulting in "version unknown" errors The fix uses RUBYOPT with Ruby's -r flag instead of TESTOPTS. This properly requires the loader before tests run, avoiding the conflict with rake's verbose handling. Fixes compatibility with: - Rake 13.4.0+ with Rake::TestTask verbose mode enabled - Projects using t.verbose = true in Rakefile See: ruby/rake#723 See: ruby/rake#394
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.
Problem
Rake 13.4.0 introduced verbose console support by setting
ENV["TESTOPTS"] = "-v"(ruby/rake#394). Rake 13.4.2 improved this to preserve existing TESTOPTS values and append-vonly when not present (ruby/rake#723).However, ci_reporter_test_unit was adding the
test_unit_loader.rbfile path to TESTOPTS, which caused conflicts:Before rake 13.4.2:
After rake 13.4.2:
-vcaused rake_test_loader to interpret the loader file as a test filerake_test_loader: version unknownor<filename>: version unknownerrorst.verbose = truein Rake::TestTaskSolution
Use
RUBYOPTwith Ruby's-rflag instead of TESTOPTS. This properly requires the loader before tests run, avoiding conflicts with rake's verbose handling.Testing
Manually tested with:
t.verbose = trueReferences
ENV["TESTOPTS"]when verbose is enabled ruby/rake#723 - Fix that preserved TESTOPTSCompatibility
This change is backwards compatible - RUBYOPT with
-rworks with all Ruby and rake versions.