Sha256: 6d866da087a3de56560675740dccc2a97858dc99e89d5d0a6d347308eab53336

Contents?: true

Size: 892 Bytes

Versions: 57

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true
require 'minitest/reporters'
require 'fileutils'
require 'json'

require 'minitest/queue/test_data'

module Minitest
  module Queue
    class TestDataReporter < Minitest::Reporters::BaseReporter
      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

      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
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
ci-queue-0.58.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.57.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.56.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.55.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.52.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.51.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.50.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.49.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.48.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.47.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.46.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.45.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.44.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.43.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.42.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.41.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.40.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.39.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.38.0 lib/minitest/queue/test_data_reporter.rb
ci-queue-0.37.0 lib/minitest/queue/test_data_reporter.rb