Skip to content

Commit

Permalink
Enable Rails minitest plugin in our rake tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed May 23, 2024
1 parent fd6c266 commit 7ee34d9
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions actioncable/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 2 additions & 0 deletions actionmailbox/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions actionmailer/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions actiontext/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*")
Expand Down
2 changes: 2 additions & 0 deletions actionview/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ task default: :test

task :package

ENV["RAILS_MINITEST_PLUGIN"] = "true"

# Run the unit tests

desc "Run all unit tests"
Expand Down
2 changes: 2 additions & 0 deletions activejob/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions activemodel/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 2 additions & 0 deletions activerecord/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) ?
Expand Down
2 changes: 2 additions & 0 deletions activestorage/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions activesupport/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions railties/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ task default: :test

task :package

ENV["RAILS_MINITEST_PLUGIN"] = "true"

desc "Run all unit tests"
task test: "test:isolated"

Expand Down
2 changes: 1 addition & 1 deletion railties/lib/minitest/rails_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7ee34d9

Please sign in to comment.