Created
August 7, 2025 20:31
-
-
Save zenspider/f36b1fa04e4fd0f704df2b7dd08f8094 to your computer and use it in GitHub Desktop.
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
modified lib/minitest.rb | |
@@ -185,6 +185,10 @@ module Minitest | |
options[:show_skips] = true | |
end | |
+ opts.on "--hard-mode", "Run tests in 'hard mode', aka fully random." do | |
+ options[:hard_mode] = true | |
+ end | |
+ | |
opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a| | |
options[:filter] = a # TODO: rename include? | |
end | |
@@ -337,7 +341,13 @@ module Minitest | |
# the serial tests won't lock around Reporter#record. Run the serial tests | |
# first, so that after they complete, the parallel tests will lock when | |
# recording results. | |
- serial.map { |suite| suite.run_suite reporter, options } + | |
+ if options[:hard_mode] then | |
+ serial.flat_map { |suite| suite.runnable_methods.map { |m| [suite, m] } } | |
+ .shuffle | |
+ .map { |(suite, method_name)| suite.run suite, method_name, reporter } | |
+ else | |
+ serial.map { |suite| suite.run_suite reporter, options } | |
+ end + | |
parallel.map { |suite| suite.run_suite reporter, options } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment