Method: Minitest.autorun

Defined in:
lib/minitest.rb

.autorunObject

Registers Minitest to run at process exit



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/minitest.rb', line 69

def self.autorun
  Warning[:deprecated] = true if
    Object.const_defined?(:Warning) && Warning.respond_to?(:[]=)

  at_exit {
    next if $! and not ($!.kind_of? SystemExit and $!.success?)

    exit_code = nil

    pid = Process.pid
    at_exit {
      next if !Minitest.allow_fork && Process.pid != pid
      @@after_run.reverse_each(&:call)
      exit exit_code || false
    }

    exit_code = Minitest.run ARGV
  } unless @@installed_at_exit
  @@installed_at_exit = true
end