diff --git a/actioncable/Rakefile b/actioncable/Rakefile index d61d38d8e7..87fa4d2933 100644 --- a/actioncable/Rakefile +++ b/actioncable/Rakefile @@ -10,6 +10,8 @@ task default: :test task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + Rake::TestTask.new do |t| t.libs << "test" t.test_files = FileList["#{__dir__}/test/**/*_test.rb"] diff --git a/actionmailbox/Rakefile b/actionmailbox/Rakefile index 92d1bba635..353f526344 100644 --- a/actionmailbox/Rakefile +++ b/actionmailbox/Rakefile @@ -6,6 +6,8 @@ require "rake/testtask" task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + Rake::TestTask.new do |t| t.libs << "test" t.pattern = "test/**/*_test.rb" diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index 6ac408e1cb..d0d6733343 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -7,6 +7,8 @@ task default: [ :test ] task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + # Run the unit tests Rake::TestTask.new { |t| t.libs << "test" diff --git a/actionpack/Rakefile b/actionpack/Rakefile index cddc536d3b..02e1c6d96d 100644 --- a/actionpack/Rakefile +++ b/actionpack/Rakefile @@ -9,6 +9,8 @@ task default: :test task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + # Run the unit tests Rake::TestTask.new do |t| t.libs << "test" diff --git a/actiontext/Rakefile b/actiontext/Rakefile index 4d6d7f4265..112f347b9d 100644 --- a/actiontext/Rakefile +++ b/actiontext/Rakefile @@ -6,6 +6,8 @@ require "rake/testtask" task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + Rake::TestTask.new do |t| t.libs << "test" t.test_files = FileList["test/**/*_test.rb"].exclude("test/system/**/*", "test/dummy/**/*") diff --git a/actionview/Rakefile b/actionview/Rakefile index 6aa58d5fa6..03f45bdaab 100644 --- a/actionview/Rakefile +++ b/actionview/Rakefile @@ -10,6 +10,8 @@ task default: :test task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + # Run the unit tests desc "Run all unit tests" diff --git a/activejob/Rakefile b/activejob/Rakefile index 0529c24a7d..4971d15774 100644 --- a/activejob/Rakefile +++ b/activejob/Rakefile @@ -10,6 +10,8 @@ task test: "test:default" task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + namespace :test do desc "Run all adapter tests" task :default do diff --git a/activemodel/Rakefile b/activemodel/Rakefile index c9a9d197c1..13002ebada 100644 --- a/activemodel/Rakefile +++ b/activemodel/Rakefile @@ -6,6 +6,8 @@ task default: :test task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + Rake::TestTask.new do |t| t.libs << "test" t.test_files = FileList["#{__dir__}/test/cases/**/*_test.rb"] diff --git a/activerecord/Rakefile b/activerecord/Rakefile index 414d62f219..6c4c7ad595 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -23,6 +23,8 @@ task default: :test task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + desc "Run mysql2, trilogy, sqlite, and postgresql tests" task :test do tasks = defined?(JRUBY_VERSION) ? diff --git a/activestorage/Rakefile b/activestorage/Rakefile index 0d71f44595..be476acd30 100644 --- a/activestorage/Rakefile +++ b/activestorage/Rakefile @@ -4,6 +4,8 @@ require "bundler/setup" require "bundler/gem_tasks" require "rake/testtask" +ENV["RAILS_MINITEST_PLUGIN"] = "true" + Rake::TestTask.new do |t| t.libs << "app/controllers" t.libs << "test" diff --git a/activesupport/Rakefile b/activesupport/Rakefile index fd60a14155..4c48dfc887 100644 --- a/activesupport/Rakefile +++ b/activesupport/Rakefile @@ -6,6 +6,8 @@ task default: :test task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + Rake::TestTask.new do |t| t.pattern = "test/**/*_test.rb" t.warning = true diff --git a/railties/Rakefile b/railties/Rakefile index 19a0e7b9e3..74f6c9be7d 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -7,6 +7,8 @@ task default: :test task :package +ENV["RAILS_MINITEST_PLUGIN"] = "true" + desc "Run all unit tests" task test: "test:isolated" diff --git a/railties/lib/minitest/rails_plugin.rb b/railties/lib/minitest/rails_plugin.rb index e57643f6d8..a61ef3087d 100644 --- a/railties/lib/minitest/rails_plugin.rb +++ b/railties/lib/minitest/rails_plugin.rb @@ -110,7 +110,7 @@ def self.plugin_rails_options(opts, options) # minitest-reporters, maxitest, and others. def self.plugin_rails_init(options) # Don't mess with Minitest unless RAILS_ENV is set - return unless ENV["RAILS_ENV"] + return unless ENV["RAILS_ENV"] || ENV["RAILS_MINITEST_PLUGIN"] unless options[:full_backtrace] # Plugin can run without Rails loaded, check before filtering.