Sha256: ac7d6639c19c6e647a7314161054cf197db53c1efa734ec5d7819b531f688e83

Contents?: true

Size: 1.22 KB

Versions: 4

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, options)
    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

4 entries across 4 versions & 1 rubygems

Version Path
minitest-distributed-0.2.7 lib/minitest/distributed_plugin.rb
minitest-distributed-0.2.6 lib/minitest/distributed_plugin.rb
minitest-distributed-0.2.5 lib/minitest/distributed_plugin.rb
minitest-distributed-0.2.4 lib/minitest/distributed_plugin.rb