Module: Selective::Ruby::Minitest::Monkeypatches::Minitest

Defined in:
lib/selective/ruby/minitest/monkeypatches.rb

Instance Method Summary collapse

Instance Method Details

#autorunObject



6
7
8
9
# File 'lib/selective/ruby/minitest/monkeypatches.rb', line 6

def autorun
  # Noop. Rails calls autorun from: lib/active_support/testing/autorun.rb
  # when rails/test_help is required in test helper (which is normal rails test setup)
end

#selective_postrun(reporter, args = []) ⇒ Object

This is the second half of ::Minitest.run



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/selective/ruby/minitest/monkeypatches.rb', line 34

def selective_postrun(reporter, args = [])
  options = process_args args

  parallel_executor.shutdown

  # might have been removed/replaced during init_plugins:
  summary = reporter.reporters.grep(::Minitest::SummaryReporter).first

  reporter.report

  return empty_run! options if summary && summary.count == 0
  reporter.passed?
end

#selective_prerun(args = []) ⇒ Object

This is the first half of Minitest.run



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/selective/ruby/minitest/monkeypatches.rb', line 12

def selective_prerun(args = [])
  load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]

  options = process_args args

  ::Minitest.seed = options[:seed]
  srand ::Minitest.seed

  reporter = ::Minitest::CompositeReporter.new
  reporter << ::Minitest::SummaryReporter.new(options[:io], options)
  reporter << ::Minitest::ProgressReporter.new(options[:io], options) unless options[:quiet]

  self.reporter = reporter # this makes it available to plugins
  init_plugins options.merge(report_name: ->(name) { "report-#{name}-#{SecureRandom.uuid}.xml" })
  self.reporter = nil # runnables shouldn't depend on the reporter, ever

  parallel_executor.start if parallel_executor.respond_to?(:start)
  reporter.start
  reporter
end