minitest-reporters-llm 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54abd03bb156c3695843a4eabbd357ca78fb62e7a2aa3583cfdaae6a3b230e7f
4
- data.tar.gz: f0f26ab22f2849a264ba40fec91f2f505b2f0f41c38b1365363624e11d66c3f8
3
+ metadata.gz: 24396eca3f60964a6fc94b3db54b83149aa25909a82bf7873ebf895a7d5062bd
4
+ data.tar.gz: 5a1a2994edb32c87ea66180d093ab156a1a83ae2ebe2ebcf4770683c139a2612
5
5
  SHA512:
6
- metadata.gz: 1e588f8816062ac07f38d1f7ef560861dbc43501f072f4579aeebc5e15f0516ecc4eef0183e7cc240e9f7583030fe61679ed23554fdcd37ddb2aabbf96256472
7
- data.tar.gz: 57567c6ac21069a1146cd3200ce7dc2973783d493e0932422844478fb069b5e8276396529eb7aef46cc4fbd6c98a55904b6215a8f25f0a2c19a16796e19e22de
6
+ metadata.gz: 64a020be84bc34733523a8714f10e45493c22212e8e6ab55303235e0df07b20e2f6ed4e417c47d64272fd2e5da0ec3230fed4f8369d2882c5adadd97c7e7dccc
7
+ data.tar.gz: 5106fc7514430d1fb726a2147ba8d4b98801e7895c167e69ab23d445f8f033daffd74fd96befcc831867e8cd85b4227a50c4391416394f2a393fdc4fe5194096
data/README.md CHANGED
@@ -81,6 +81,9 @@ FAIL test_validation_fails
81
81
  # Override default file paths
82
82
  export LLM_REPORTER_RESULTS="custom/results.json"
83
83
  export LLM_REPORTER_TOML="custom/report.toml"
84
+
85
+ # Override default format
86
+ export LLM_REPORTER_FORMAT="verbose" # or "compact" (default)
84
87
  ```
85
88
 
86
89
  ### Regression Tracking
@@ -104,7 +107,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
104
107
  - **Dual output modes**: Compact for LLMs, verbose for humans
105
108
  - **Configurable file paths**: No hardcoded temporary directories
106
109
  - **TOML/JSON reports**: Structured data export for further analysis
107
- - **Zero dependencies**: Only requires minitest-reporters
110
+ - **Minimal dependencies**: Built on minitest and minitest-reporters
108
111
 
109
112
  ## Why Use This Reporter?
110
113
 
data/bin/console CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'bundler/setup'
5
- require 'minitest/llm/reporter'
5
+ require 'minitest/reporters/llm'
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -3,7 +3,7 @@
3
3
  module Minitest
4
4
  module Reporters
5
5
  module LLM
6
- VERSION = '0.1.0'
6
+ VERSION = '0.3.0'
7
7
  end
8
8
  end
9
9
  end
@@ -11,6 +11,9 @@ module Minitest
11
11
 
12
12
  def initialize(options = {})
13
13
  super
14
+ custom_io = options.delete(:io)
15
+ @io = custom_io if custom_io
16
+
14
17
  @options = default_options.merge(options)
15
18
  @results_file = @options[:results_file]
16
19
  @report_file = @options[:report_file]
@@ -26,8 +29,19 @@ module Minitest
26
29
 
27
30
  def record(result)
28
31
  super
32
+ status =
33
+ if result.skipped?
34
+ 'skip'
35
+ elsif result.error?
36
+ 'error'
37
+ elsif result.passed?
38
+ 'pass'
39
+ else
40
+ 'fail'
41
+ end
42
+
29
43
  test_key = "#{result.klass}##{result.name}"
30
- @current_results[test_key] = result.passed? ? 'pass' : 'fail'
44
+ @current_results[test_key] = status
31
45
  end
32
46
 
33
47
  def report
@@ -108,10 +122,13 @@ module Minitest
108
122
  private
109
123
 
110
124
  def default_options
125
+ format_env = ENV['LLM_REPORTER_FORMAT']&.downcase
126
+ format = format_env == 'verbose' ? :verbose : :compact
127
+
111
128
  {
112
129
  results_file: ENV.fetch('LLM_REPORTER_RESULTS', 'tmp/test_results.json'),
113
130
  report_file: ENV.fetch('LLM_REPORTER_TOML', 'tmp/test_report.toml'),
114
- format: :compact,
131
+ format: format,
115
132
  track_regressions: true,
116
133
  write_reports: true
117
134
  }
@@ -192,7 +209,7 @@ module Minitest
192
209
  end
193
210
 
194
211
  def show_failure_details
195
- failed_tests = tests_list.select { |t| t.failure && !t.skipped? }
212
+ failed_tests = tests_list.select { |t| t.failure && !t.skipped? && !t.error? }
196
213
  error_tests = tests_list.select { |t| t.failure && t.error? }
197
214
 
198
215
  return unless failed_tests.any? || error_tests.any?
@@ -257,10 +274,11 @@ module Minitest
257
274
 
258
275
  @current_results.each do |test_key, status|
259
276
  previous_status = @previous_results[test_key]
277
+ next unless previous_status
260
278
 
261
- if previous_status == 'pass' && status == 'fail'
279
+ if previous_status == 'pass' && %w[fail error].include?(status)
262
280
  new_failures << test_key_to_location(test_key)
263
- elsif previous_status == 'fail' && status == 'pass'
281
+ elsif %w[fail error skip].include?(previous_status) && status == 'pass'
264
282
  fixes << test_key_to_location(test_key)
265
283
  end
266
284
  end
@@ -277,8 +295,10 @@ module Minitest
277
295
 
278
296
  @current_results.each do |test_key, status|
279
297
  previous_status = @previous_results[test_key]
280
- new_failures += 1 if previous_status == 'pass' && status == 'fail'
281
- fixes += 1 if previous_status == 'fail' && status == 'pass'
298
+ next unless previous_status
299
+
300
+ new_failures += 1 if previous_status == 'pass' && %w[fail error].include?(status)
301
+ fixes += 1 if %w[fail error skip].include?(previous_status) && status == 'pass'
282
302
  end
283
303
 
284
304
  puts "REG +#{new_failures} -#{fixes}" if new_failures.positive? || fixes.positive?
@@ -324,8 +344,10 @@ module Minitest
324
344
  fixes = []
325
345
  @current_results.each do |k, status|
326
346
  prev = @previous_results[k]
327
- new_failures << test_key_to_location(k) if prev == 'pass' && status == 'fail'
328
- fixes << test_key_to_location(k) if prev == 'fail' && status == 'pass'
347
+ next unless prev
348
+
349
+ new_failures << test_key_to_location(k) if prev == 'pass' && %w[fail error].include?(status)
350
+ fixes << test_key_to_location(k) if %w[fail error skip].include?(prev) && status == 'pass'
329
351
  end
330
352
  data[:regressions] = { new_failures: new_failures, fixes: fixes }
331
353
  end
@@ -358,8 +380,13 @@ module Minitest
358
380
  key = k.to_s
359
381
  case v
360
382
  when Array
361
- escaped = v.map { |s| s.to_s.gsub('\\', '\\\\').gsub('"', '\\"') }
362
- lines << "#{key} = [\"#{escaped.join('\", \"')}\"]"
383
+ if v.empty?
384
+ lines << "#{key} = []"
385
+ else
386
+ escaped = v.map { |s| s.to_s.gsub('\\', '\\\\').gsub('"', '\\"') }
387
+ joined = escaped.join('", "')
388
+ lines << "#{key} = [\"#{joined}\"]"
389
+ end
363
390
  when String
364
391
  val = v.to_s.gsub('\\', '\\\\').gsub('"', '\\"')
365
392
  lines << "#{key} = \"#{val}\""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-reporters-llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih