Sha256: 5407bf369c71c0abe85ccc2d02127870329929013262f3d6c652241bedac94c0

Contents?: true

Size: 540 Bytes

Versions: 9

Compression:

Stored size: 540 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('%10.4f %s', result.time, result.location)
      end
    end
  end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gir_ffi-0.11.1 test/minitest/stats_plugin.rb
gir_ffi-0.11.0 test/minitest/stats_plugin.rb
gir_ffi-0.10.2 test/minitest/stats_plugin.rb
gir_ffi-0.10.1 test/minitest/stats_plugin.rb
gir_ffi-0.10.0 test/minitest/stats_plugin.rb
gir_ffi-0.10.0.pre1 test/minitest/stats_plugin.rb
gir_ffi-0.9.5 test/minitest/stats_plugin.rb
gir_ffi-0.9.4 test/minitest/stats_plugin.rb
gir_ffi-0.9.3 test/minitest/stats_plugin.rb