module Minitest

def self.run args = []

def self.run args = []
  self.load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]
  options = process_args args
  Minitest.seed = options[:seed]
  srand Minitest.seed
  reporter = CompositeReporter.new
  reporter << SummaryReporter.new(options[:io], options)
  reporter << ProgressReporter.new(options[:io], options) unless options[:quiet]
  self.reporter = reporter # this makes it available to plugins
  self.init_plugins options
  self.reporter = nil # runnables shouldn't depend on the reporter, ever
  self.parallel_executor.start if parallel_executor.respond_to? :start
  reporter.start
  begin
    __run reporter, options
  rescue Interrupt
    warn "Interrupted. Exiting..."
  end
  self.parallel_executor.shutdown
  # might have been removed/replaced during init_plugins:
  summary = reporter.reporters.grep(SummaryReporter).first
  reporter.report
  return empty_run! options if summary && summary.count == 0
  reporter.passed?
end