module Minitest
The top-level namespace for Minitest. Also the location of the main runtime. See Minitest.run for more information.
The top-level namespace for Minitest. Also the location of the main runtime. See Minitest.run for more information.
Attributes
untyped
untyped
untyped
untyped
untyped
untyped
untyped
Public Class Methods
(untyped reporter, untyped options) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 80
def self.__run: (untyped reporter, untyped options) -> untyped
Internal run method. Responsible for telling all Runnable sub-classes to run.
() { (?) → untyped } → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 95 def self.after_run &block @@after_run << block end
A simple hook allowing you to run a block of code after everything is done running. Eg:
Minitest.after_run { p $debugging_info }
A simple hook allowing you to run a block of code after everything is done running. Eg:
Minitest.after_run { p $debugging_info }
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 69 def self.autorun Warning[:deprecated] = true 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
(untyped name) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 12
def self.cattr_accessor: (untyped name) -> untyped
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 86
def self.clock_time: () -> untyped
(untyped options) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 72
def self.empty_run!: (untyped options) -> untyped
(untyped bt) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 82
def self.filter_backtrace: (untyped bt) -> untyped
(untyped options) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 43
def self.init_plugins: (untyped options) -> untyped
(*untyped names) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 102 def self.load *names names.each do |name| require "minitest/#{name}_plugin" self.extensions << name.to_s end end
Manually load plugins by name.
Manually load plugins by name.
() → (nil | untyped)
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 41
def self.load_plugins: () -> (nil | untyped)
(untyped options) → (nil | untyped)
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 98
def self.plugin_pride_init: (untyped options) -> (nil | untyped)
(untyped opts, untyped _options) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 96
def self.plugin_pride_options: (untyped opts, untyped _options) -> untyped
(?untyped args) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 45
def self.process_args: (?untyped args) -> untyped
(untyped name_or_mod) → nil
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 113 def self.register_plugin name_or_mod self.extensions << name_or_mod nil end
Register a plugin to be used. Does NOT require / load it.
Register a plugin to be used. Does NOT require / load it.
(?untyped args) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 299 def self.run args = [] 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_all_suites reporter, options finished = true rescue Interrupt warn "Interrupted. Exiting..." end self.parallel_executor.shutdown if parallel_executor.respond_to? :shutdown # might have been removed/replaced during init_plugins: summary = reporter.reporters.grep(SummaryReporter).first reporter.report return empty_run! options if finished && summary && summary.count == 0 finished and reporter.passed? end
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.load_plugins] optional, called by user, or require what you want
Minitest.autorun
Minitest.run(args)
Minitest.process_args
Minitest.init_plugins
Minitest.run_all_suites(reporter, options)
Runnable.runnables.each |runnable_klass|
runnable_klass.run_suite(reporter, options)
filtered_methods = runnable_klass.filter_runnable_methods options
filtered_methods.each |runnable_method|
runnable_klass.run(self, runnable_method, reporter)
runnable_klass.new(runnable_method).run
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.load_plugins Minitest.process_args Minitest.init_plugins Minitest.__run(reporter, options) Runnable.runnables.each runnable_klass.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 vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 352 def self.run_all_suites reporter, options suites = Runnable.runnables.shuffle parallel, serial = suites.partition { |s| s.run_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_suite reporter, options } + parallel.map { |suite| suite.run_suite reporter, options } end
Internal run method. Responsible for telling all Runnable sub-classes to run.
(untyped klass, untyped method_name) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest.rbs, line 84
def self.run_one_method: (untyped klass, untyped method_name) -> untyped
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 43 cattr_accessor :backtrace_filter
Filter object for backtraces.
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 55 cattr_accessor :extensions
Names of known extension plugins.
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 60 cattr_accessor :info_signal
The signal to use for dumping information to STDERR. Defaults to βINFOβ.
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 34 cattr_accessor :parallel_executor
Parallel test executor
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 50 cattr_accessor :reporter
Reporter object to be used for all runs.
NOTE: This accessor is only available during setup, not during runs.
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest.rb, line 29 cattr_accessor :seed
The random seed used for this run. This is used to srand at the start of the run and between each Runnable.run.
Set via Minitest.run after processing args.