Sha256: 2f076b4eb7e8b1b25a14610b66242509968962b61cf8c2596bdd6452f1cbed58

Contents?: true

Size: 613 Bytes

Versions: 6

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

module Minitest
  class StatsReporter < AbstractReporter
    def initialize(_options)
      @results = []
    end

    def start
      @current_time = Time.now
    end

    def record(result)
      @results << result
    end

    def report
      slowest = @results.sort_by(&:time).reverse.first(10)
      slowest.each do |result|
        puts format('%<time>10.4f %<location>s',
                    time: result.time,
                    location: result.location)
      end
    end
  end

  def self.plugin_stats_init(options)
    reporter << StatsReporter.new(options)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gir_ffi-0.14.1 test/minitest/stats_plugin.rb
gir_ffi-0.14.0 test/minitest/stats_plugin.rb
gir_ffi-0.13.1 test/minitest/stats_plugin.rb
gir_ffi-0.13.0 test/minitest/stats_plugin.rb
gir_ffi-0.12.1 test/minitest/stats_plugin.rb
gir_ffi-0.12.0 test/minitest/stats_plugin.rb