class Minitest::Queue::GrindReporter
Attributes
build[R]
Public Class Methods
new(build:, **options)
click to toggle source
Calls superclass method
# File lib/minitest/queue/grind_reporter.rb, line 9 def initialize(build:, **options) @build = build @success = true super(options) end
Public Instance Methods
fetch_counts(test)
click to toggle source
# File lib/minitest/queue/grind_reporter.rb, line 64 def fetch_counts(test) key = "count##{test}" build.fetch_stats([key])[key] end
flaky_tests()
click to toggle source
# File lib/minitest/queue/grind_reporter.rb, line 47 def flaky_tests @flaky_tests ||= begin flaky_tests = {} build.error_reports.each do |error| err = ErrorReport.load(error) name = err.test_and_module_name flaky_tests[name] ||= [] flaky_tests[name] << err end flaky_tests end end
record(*)
click to toggle source
# File lib/minitest/queue/grind_reporter.rb, line 60 def record(*) raise NotImplementedError end
report()
click to toggle source
# File lib/minitest/queue/grind_reporter.rb, line 15 def report puts '+++ Results' if flaky_tests.empty? puts green('all tests passed every time, grinding did not uncover any flakiness') return end @success = false flaky_tests.each do |name, errors| total_runs = fetch_counts(name) flakiness_percentage = (errors.count / total_runs) * 100 error_messages = errors.map do |message| message.to_s.lines.map { |l| "\t#{l}"}.join end.to_set.to_a.join("\n\n") puts <<~EOS #{red(name)} Runs: #{total_runs.to_i} Failures: #{errors.count} Flakiness Percentage: #{flakiness_percentage.to_i}% Errors: #{error_messages} EOS end end
success?()
click to toggle source
# File lib/minitest/queue/grind_reporter.rb, line 43 def success? @success end