Module: Minitest (Ruby 2.7.5)
Description: Module : Minitest - Ruby 2.7.5

### Home Classes Methods

### In Files

- minitest-5.13.0/lib/minitest.rb
- minitest-5.13.0/lib/minitest/assertions.rb
- minitest-5.13.0/lib/minitest/benchmark.rb
- minitest-5.13.0/lib/minitest/expectations.rb
- minitest-5.13.0/lib/minitest/hell.rb
- minitest-5.13.0/lib/minitest/mock.rb
- minitest-5.13.0/lib/minitest/parallel.rb
- minitest-5.13.0/lib/minitest/pride.rb
- minitest-5.13.0/lib/minitest/pride_plugin.rb
- minitest-5.13.0/lib/minitest/spec.rb
- minitest-5.13.0/lib/minitest/test.rb
- minitest-5.13.0/lib/minitest/unit.rb

### Namespace

- MODULE Minitest::Assertions
- MODULE Minitest::Expectations
- MODULE Minitest::Guard
- MODULE Minitest::Parallel
- MODULE Minitest::Reportable
- CLASS Minitest::AbstractReporter
- CLASS Minitest::Assertion
- CLASS Minitest::BacktraceFilter
- CLASS Minitest::BenchSpec
- CLASS Minitest::Benchmark
- CLASS Minitest::CompositeReporter
- CLASS Minitest::Mock
- CLASS Minitest::PrideIO
- CLASS Minitest::PrideLOL
- CLASS Minitest::ProgressReporter
- CLASS Minitest::Result
- CLASS Minitest::Runnable
- CLASS Minitest::Skip
- CLASS Minitest::Spec
- CLASS Minitest::StatisticsReporter
- CLASS Minitest::SummaryReporter
- CLASS Minitest::Test
- CLASS Minitest::UnexpectedError
- CLASS Minitest::Unit

### Methods

- ::__run
- ::after_run
- ::autorun
- ::run
- #unknown

### Files

- History.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Kernel
- Minitest::AbstractReporter
- Minitest::Assertion
- Minitest::Assertions
- Minitest::BacktraceFilter
- Minitest::BenchSpec
- Minitest::Benchmark
- Minitest::CompositeReporter
- Minitest::Expectations
- Minitest::Guard
- Minitest::Mock
- Minitest::Parallel
- Minitest::Parallel::Executor
- Minitest::PrideIO
- Minitest::PrideLOL
- Minitest::ProgressReporter
- Minitest::Reportable
- Minitest::Result
- Minitest::Skip
- Minitest::Spec
- Minitest::Spec::DSL
- Minitest::Spec::DSL::InstanceMethods
- Minitest::StatisticsReporter
- Minitest::SummaryReporter
- Minitest::Test
- Minitest::Test::LifecycleHooks
- Minitest::UnexpectedError
- Object
- SubThingySpec
- ThingySpec

No matching classes.

# Minitest

### Public Class Methods

__run(reporter, options) click to toggle source

Internal run method. Responsible for telling all Runnable sub-classes to run.

                   # File minitest-5.13.0/lib/minitest.rb, line 155
    def self.__run reporter, options
      suites = Runnable.runnables.reject { |s| s.runnable_methods.empty? }.shuffle
      parallel, serial = suites.partition { |s| s.test_order == :parallel }

      # If we run the parallel tests before the serial tests, the parallel tests
      # could run in parallel with the serial tests. This would be bad because
      # the serial tests won't lock around Reporter#record. Run the serial tests
      # first, so that after they complete, the parallel tests will lock when
      # recording results.
      serial.map { |suite| suite.run reporter, options } +
        parallel.map { |suite| suite.run reporter, options }
    end

after_run(&block) click to toggle source

A simple hook allowing you to run a block of code after everything is done running. Eg:

    Minitest.after_run { p $debugging_info }

                   # File minitest-5.13.0/lib/minitest.rb, line 79
    def self.after_run &block
      @@after_run << block
    end

autorun() click to toggle source

Registers Minitest to run at process exit

                   # File minitest-5.13.0/lib/minitest.rb, line 55
    def self.autorun
      at_exit {
        next if $! and not ($!.kind_of? SystemExit and $!.success?)

        exit_code = nil

        pid = Process.pid
        at_exit {
          next if 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

run(args = []) click to toggle source

This is the top-level run method. Everything starts from here. It tells each Runnable sub-class to run, and each of those are responsible for doing whatever they do.

The overall structure of a run looks like this:

    Minitest.autorun
      Minitest.run(args)
        Minitest.__run(reporter, options)
          Runnable.runnables.each
            runnable.run(reporter, options)
              self.runnable_methods.each
                self.run_one_method(self, runnable_method, reporter)
                  Minitest.run_one_method(klass, runnable_method)
                    klass.new(runnable_method).run

                   # File minitest-5.13.0/lib/minitest.rb, line 125
    def self.run args = []
      self.load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]

      options = process_args args

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

      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
      reporter.report

      reporter.passed?
    end

### Public Instance Methods

unknown click to toggle source

`Parallel` test executor

                   # File minitest-5.13.0/lib/minitest.rb, line 23
    mc.send :attr_accessor, :parallel_executor