Class: Minitest::Reporters::LLMReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- Minitest::Reporters::LLMReporter
- Defined in:
- lib/minitest/reporters/llm_reporter.rb
Constant Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ LLMReporter
constructor
A new instance of LLMReporter.
- #record(result) ⇒ Object
- #report ⇒ Object
- #report_compact(total, passes, fails_ct, errors_ct, skips_ct) ⇒ Object
- #report_verbose(total, passes, fails_ct, errors_ct, skips_ct) ⇒ Object
- #start(*args) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ LLMReporter
Returns a new instance of LLMReporter.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/minitest/reporters/llm_reporter.rb', line 12 def initialize( = {}) super custom_io = .delete(:io) @io = custom_io if custom_io @options = .merge() @results_file = @options[:results_file] @report_file = @options[:report_file] @previous_results = @options[:track_regressions] ? load_previous_results : {} @current_results = {} @llm_start_time = nil end |
Instance Method Details
#record(result) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/minitest/reporters/llm_reporter.rb', line 30 def record(result) super status = if result.skipped? 'skip' elsif result.error? 'error' elsif result.passed? 'pass' else 'fail' end test_key = "#{result.klass}##{result.name}" @current_results[test_key] = status end |
#report ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/minitest/reporters/llm_reporter.rb', line 47 def report total = @current_results.size fails_ct = tests_list.count { |t| t.failure && !t.skipped? && !t.error? } errors_ct = tests_list.count { |t| t.failure && t.error? } skips_ct = tests_list.count(&:skipped?) passes = total - fails_ct - errors_ct - skips_ct if @options[:format] == :compact report_compact(total, passes, fails_ct, errors_ct, skips_ct) else report_verbose(total, passes, fails_ct, errors_ct, skips_ct) end save_current_results if @options[:track_regressions] write_toml_summary end |
#report_compact(total, passes, fails_ct, errors_ct, skips_ct) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/minitest/reporters/llm_reporter.rb', line 64 def report_compact(total, passes, fails_ct, errors_ct, skips_ct) puts "#{total} tests,#{passes} passed,#{fails_ct} failures,#{errors_ct} errors,#{skips_ct} skips #{format_time(llm_total_time)}" show_regressions_compact # Show failures if fails_ct.positive? tests_list.select { |t| t.failure && !t.skipped? && !t.error? }.each do |test| puts "FAIL #{format_test_location_compact(test)}" end end # Show errors if errors_ct.positive? tests_list.select { |t| t.failure && t.error? }.each do |test| puts "ERROR #{format_test_location_compact(test)}" end end # Show skips return unless skips_ct.positive? tests_list.select(&:skipped?).each do |test| puts "SKIP #{format_test_location_compact(test)}" end end |
#report_verbose(total, passes, fails_ct, errors_ct, skips_ct) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/minitest/reporters/llm_reporter.rb', line 91 def report_verbose(total, passes, fails_ct, errors_ct, skips_ct) puts puts "🏃 #{total} tests (#{format_time(llm_total_time)})" puts "✅ #{passes}" if passes.positive? show_regressions if fails_ct.positive? failed_tests = tests_list.select { |t| t.failure && !t.skipped? && !t.error? } .map { |test| format_test_location(test) } puts "❌ #{failed_tests.size} failed: #{failed_tests.join(', ')}" if failed_tests.any? end if errors_ct.positive? error_tests = tests_list.select { |t| t.failure && t.error? } .map { |test| format_test_location(test) } puts "💥 #{errors_ct}: #{error_tests.join(', ')}" end if skips_ct.positive? skip_tests = tests_list.select(&:skipped?) puts "⏭️ #{skips_ct} skipped:" skip_tests.each do |test| msg = (test.failure&.) puts " - #{format_test_location(test)}: #{msg}" end end show_failure_details if fails_ct.positive? || errors_ct.positive? end |
#start(*args) ⇒ Object
25 26 27 28 |
# File 'lib/minitest/reporters/llm_reporter.rb', line 25 def start(*args) super @llm_start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) end |