Created
February 14, 2025 20:57
-
-
Save zenspider/5d342b2f5553a23e6d5d08db829ae4af 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
### Renames:: | |
* Minitest.__run becomes Minitest.run_all_suites | |
* Runnable.run becomes Runnable.run_suite | |
* Minitest.run_one_method becomes Runnable.run (essentially, see below) | |
### Additions:: | |
* Added Runnable#filter_runnable_methods # extraction from Runnable.run_suite | |
* ? maybe add --plugins option? | |
### Removals:: | |
* lots of ancient compatibility code, checking encodings etc. | |
* Minitest.load_plugins is no longer called by default | |
* Minitest.run_one_method gets absorbed by Runnable.run # not sure about this one | |
this change mixes reporter actions and test invocation: | |
diff --git a/lib/minitest.rb b/lib/minitest.rb | |
index 7624732..1054c59 100644 | |
--- a/lib/minitest.rb | |
+++ b/lib/minitest.rb | |
@@ -443,7 +460,8 @@ module Minitest | |
- def self.run_one_method klass, method_name, reporter | |
+ def Runnable.run klass, method_name, reporter | |
reporter.prerecord klass, method_name | |
- reporter.record Minitest.run_one_method(klass, method_name) | |
+ result = klass.new(method_name).run | |
+ # raise "#{klass}#run _must_ return a Result" unless Result === result | |
+ reporter.record result | |
end | |
---- | |
Here's the overall run sequence change: | |
@@ -249,20 +260,19 @@ | |
## | |
# This is the top-level run method. Everything starts from here. It | |
# tells each Runnable sub-class to run, and each of those are | |
# responsible for doing whatever they do. | |
# | |
# The overall structure of a run looks like this: | |
# | |
+ # [Minitest.load_plugins] optional, called by user, or require what you want | |
# Minitest.autorun | |
# Minitest.run(args) | |
- # Minitest.load_plugins | |
# Minitest.process_args | |
# Minitest.init_plugins | |
- # Minitest.__run(reporter, options) | |
+ # Minitest.run_all_suites(reporter, options) | |
# Runnable.runnables.each |runnable_klass| | |
- # runnable_klass.run(reporter, options) | |
- # runnable_klass.runnable_methods.each |runnable_method| | |
- # runnable_methods.select {...}.reject {...} | |
- # runnable_klass.run_one_method(self, runnable_method, reporter) | |
- # Minitest.run_one_method(runnable_klass, runnable_method) | |
+ # runnable_klass.run_suite(reporter, options) | |
+ # filtered_methods = runnable_klass.filter_runnable_methods options | |
+ # filtered_methods.each |runnable_method| | |
+ # runnable_klass.run(self, runnable_method, reporter) | |
# runnable_klass.new(runnable_method).run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm poking at minitest 6 with the intent of cleaning up the API to be cleaner than it curretly is. This will NOT be backwards compatible. Here's the summary diff of what I'm thinking ^^^
One thing to discuss is whether there's value in keeping
Minitest.run_one_method
(maybe pushing it down to Runnable) separate fromRunnable.run
. I'm leaning towards removal but open to discussion.