diff --git a/lib/minitest/rake_ci.rb b/lib/minitest/rake_ci.rb
index <HASH>..<HASH> 100644
--- a/lib/minitest/rake_ci.rb
+++ b/lib/minitest/rake_ci.rb
@@ -1,6 +1,9 @@
 require 'minitest'
 
-# Autodiscover the _plugin.rb file:
-Minitest.load_plugins
-Minitest::RakeCIReporter.enable!
+# Don't trigger full plugin autodiscovery, as we load this
+# file through RUBYOPT extension (and full autodiscovery can
+# lead to e.g. incomplete definitions of Rails existing).
+require_relative 'rake_ci_plugin'
+Minitest.extensions << 'rake_ci'
 
+Minitest::RakeCIReporter.enable!
# avoid triggering a minitest autodiscover in all spawned shells

Would lead to Rails being partially loaded in spawned Ruby process, breaking e.g. webpacker asset compilation