Sha256: 3a09c7ded8d91677c91eefa21f88219a97e0f774d4482d0b5fd4fbb7d8b543ac

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

# typed: true
# frozen_string_literal: true

require_relative './distributed'

module Minitest
  class << self
    extend T::Sig

    def plugin_distributed_options(opts, options)
      opts.on('--disable-distributed', "Disable the distributed plugin") do
        options[:disable_distributed] = true
      end

      options[:distributed] = Minitest::Distributed::Configuration.from_command_line_options(opts)
    end

    def plugin_distributed_init(options)
      return if options[:disable_distributed]

      Minitest.singleton_class.prepend(Minitest::Distributed::TestRunnerPatch)

      remove_reporter(::Rails::TestUnitReporter) if defined?(::Rails::TestUnitReporter)
      remove_reporter(Minitest::ProgressReporter)
      remove_reporter(Minitest::SummaryReporter)

      options[:distributed].coordinator.register_reporters(reporter: reporter, options: options)

      reporter << Minitest::Distributed::Reporters::DistributedPogressReporter.new(options[:io], options)
      reporter << Minitest::Distributed::Reporters::DistributedSummaryReporter.new(options[:io], options)
    end

    private

    def remove_reporter(reporter_class)
      reporter.reporters.reject! { |reporter| reporter.is_a?(reporter_class) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minitest-distributed-0.2.0 lib/minitest/distributed_plugin.rb