Sha256: 0166efd2a25bd10f7f8d0d638015b67cd2638a4437e704f7c9f1fe5544626023

Contents?: true

Size: 1.21 KB

Versions: 30

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true
require 'ci/queue/output_helpers'
require 'minitest/reporters'

module Minitest
  module Queue
    class LocalRequeueReporter < Minitest::Reporters::DefaultReporter
      include ::CI::Queue::OutputHelpers
      attr_accessor :requeues

      def initialize(*)
        self.requeues = 0
        super
      end

      def report
        self.requeues = results.count(&:requeued?)
        super
        print_report
      end

      private

      def print_report
        reopen_previous_step if failures > 0 || errors > 0
        success = failures.zero? && errors.zero?
        failures_count = "#{failures} failures, #{errors} errors,"
        step [
          'Ran %d tests, %d assertions,' % [count, assertions],
          success ? green(failures_count) : red(failures_count),
          yellow("#{skips} skips, #{requeues} requeues"),
          'in %.2fs' % total_time,
        ].join(' ')
      end

      def message_for(test)
        e = test.failure

        if test.requeued?
          "Requeued:\n#{test.klass}##{test.name} [#{location(e)}]:\n#{e.message}"
        else
          super
        end
      end

      def result_line
        "#{super}, #{requeues} requeues"
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
ci-queue-0.62.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.61.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.60.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.59.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.58.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.57.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.56.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.55.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.52.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.51.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.50.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.49.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.48.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.47.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.46.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.45.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.44.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.43.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.42.0 lib/minitest/queue/local_requeue_reporter.rb
ci-queue-0.41.0 lib/minitest/queue/local_requeue_reporter.rb