minitest-reporters-llm 0.2.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: 7383a0274a17bf3f857d82bbed3d42b23b366d718070516be32c8b785a416f5e
4
- data.tar.gz: 5e2306b56dddb16c219e61da959bba073940b180968d338a182373e676ac025f
3
+ metadata.gz: 24396eca3f60964a6fc94b3db54b83149aa25909a82bf7873ebf895a7d5062bd
4
+ data.tar.gz: 5a1a2994edb32c87ea66180d093ab156a1a83ae2ebe2ebcf4770683c139a2612
5
5
  SHA512:
6
- metadata.gz: cbbceb445af93fddb49719342c0357e1e0b54096165c6dbb539b3712933cf8ca3a62c3622cd2355b6eaeb3046b2e56650098e880975884ee21c28fc25a8efdf0
7
- data.tar.gz: b9e7cbf33cba4beecc7f6c734f9a028f019e272370ed57b5cfcda10c5b30891737e5c42d7bbb1f503f760b9a1a27454c36da95b216f0541471f35de5f4671311
6
+ metadata.gz: 64a020be84bc34733523a8714f10e45493c22212e8e6ab55303235e0df07b20e2f6ed4e417c47d64272fd2e5da0ec3230fed4f8369d2882c5adadd97c7e7dccc
7
+ data.tar.gz: 5106fc7514430d1fb726a2147ba8d4b98801e7895c167e69ab23d445f8f033daffd74fd96befcc831867e8cd85b4227a50c4391416394f2a393fdc4fe5194096
data/README.md CHANGED
@@ -107,7 +107,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
107
107
  - **Dual output modes**: Compact for LLMs, verbose for humans
108
108
  - **Configurable file paths**: No hardcoded temporary directories
109
109
  - **TOML/JSON reports**: Structured data export for further analysis
110
- - **Zero dependencies**: Only requires minitest-reporters
110
+ - **Minimal dependencies**: Built on minitest and minitest-reporters
111
111
 
112
112
  ## Why Use This Reporter?
113
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.2.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
@@ -195,7 +209,7 @@ module Minitest
195
209
  end
196
210
 
197
211
  def show_failure_details
198
- failed_tests = tests_list.select { |t| t.failure && !t.skipped? }
212
+ failed_tests = tests_list.select { |t| t.failure && !t.skipped? && !t.error? }
199
213
  error_tests = tests_list.select { |t| t.failure && t.error? }
200
214
 
201
215
  return unless failed_tests.any? || error_tests.any?
@@ -260,10 +274,11 @@ module Minitest
260
274
 
261
275
  @current_results.each do |test_key, status|
262
276
  previous_status = @previous_results[test_key]
277
+ next unless previous_status
263
278
 
264
- if previous_status == 'pass' && status == 'fail'
279
+ if previous_status == 'pass' && %w[fail error].include?(status)
265
280
  new_failures << test_key_to_location(test_key)
266
- elsif previous_status == 'fail' && status == 'pass'
281
+ elsif %w[fail error skip].include?(previous_status) && status == 'pass'
267
282
  fixes << test_key_to_location(test_key)
268
283
  end
269
284
  end
@@ -280,8 +295,10 @@ module Minitest
280
295
 
281
296
  @current_results.each do |test_key, status|
282
297
  previous_status = @previous_results[test_key]
283
- new_failures += 1 if previous_status == 'pass' && status == 'fail'
284
- 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'
285
302
  end
286
303
 
287
304
  puts "REG +#{new_failures} -#{fixes}" if new_failures.positive? || fixes.positive?
@@ -327,8 +344,10 @@ module Minitest
327
344
  fixes = []
328
345
  @current_results.each do |k, status|
329
346
  prev = @previous_results[k]
330
- new_failures << test_key_to_location(k) if prev == 'pass' && status == 'fail'
331
- 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'
332
351
  end
333
352
  data[:regressions] = { new_failures: new_failures, fixes: fixes }
334
353
  end
@@ -361,8 +380,13 @@ module Minitest
361
380
  key = k.to_s
362
381
  case v
363
382
  when Array
364
- escaped = v.map { |s| s.to_s.gsub('\\', '\\\\').gsub('"', '\\"') }
365
- 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
366
390
  when String
367
391
  val = v.to_s.gsub('\\', '\\\\').gsub('"', '\\"')
368
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih