class Minitest::Queue::TestDataReporter

Public Class Methods

new(report_path: 'log/test_data.json', base_path: nil, namespace: '') click to toggle source
Calls superclass method
# File lib/minitest/queue/test_data_reporter.rb, line 11
def initialize(report_path: 'log/test_data.json', base_path: nil, namespace: '')
  super({})
  @report_path = File.absolute_path(report_path)
  @base_path = base_path || Dir.pwd
  @namespace = namespace || ''
end

Public Instance Methods

report() click to toggle source
Calls superclass method
# File lib/minitest/queue/test_data_reporter.rb, line 18
def report
  super

  result = tests.map.with_index do |test, index|
    Queue::TestData.new(test: test, index: index,
                        base_path: @base_path, namespace: @namespace).to_h
  end.to_json

  dirname = File.dirname(@report_path)
  FileUtils.mkdir_p(dirname)
  File.open(@report_path, 'w+') { |file| file << result }
end