module Minitest

Public Class Methods

plugin_silence_init(options) click to toggle source
# File lib/minitest/silence_plugin.rb, line 65
def plugin_silence_init(options)
  if options[:enable_silence] || ENV["CI"]
    Minitest::Result.prepend(Minitest::Silence::ResultOutputPatch)
    Minitest.singleton_class.prepend(Minitest::Silence::RunOneMethodPatch)

    if options[:fail_on_output]
      # We have to make sure this reporter runs as the first reporter, so it can still adjust
      # the result and other reporters will take the change into account.
      reporter.reporters.unshift(Minitest::Silence::FailOnOutputReporter.new(options[:io], options))
    elsif options[:verbose]
      reporter << Minitest::Silence::BoxedOutputReporter.new(options[:io], options)
    end
  end
end
plugin_silence_options(opts, options) click to toggle source
# File lib/minitest/silence_plugin.rb, line 56
def plugin_silence_options(opts, options)
  opts.on('--enable-silence', "Rebind standard IO") do
    options[:enable_silence] = true
  end
  opts.on('--fail-on-output', "Fail a test when it writes to STDOUT or STDERR") do
    options[:fail_on_output] = true
  end
end