Skip to content

Commit 99bacb5

Browse files
authored
Merge pull request rails#55140 from Edouard-chin/ec-rails-plugin
Load tests prior to when Minitest load plugins:
2 parents 82becbe + bfbfa4a commit 99bacb5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

railties/lib/minitest/rails_plugin.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ def self.plugin_rails_options(opts, options)
134134

135135
options[:color] = true
136136
options[:output_inline] = true
137+
138+
opts.on do
139+
if ::Rails::TestUnit::Runner.load_test_files
140+
::Rails::TestUnit::Runner.load_tests(options.fetch(:test_files, []))
141+
end
142+
end
137143
end
138144

139145
# Owes great inspiration to test runner trailblazers like RSpec,
@@ -142,10 +148,6 @@ def self.plugin_rails_init(options)
142148
# Don't mess with Minitest unless RAILS_ENV is set
143149
return unless ENV["RAILS_ENV"] || ENV["RAILS_MINITEST_PLUGIN"]
144150

145-
if ::Rails::TestUnit::Runner.load_test_files
146-
::Rails::TestUnit::Runner.load_tests(options.fetch(:test_files, []))
147-
end
148-
149151
unless options[:full_backtrace]
150152
# Plugin can run without Rails loaded, check before filtering.
151153
if ::Rails.respond_to?(:backtrace_cleaner)

0 commit comments

Comments
 (0)