aboutsummaryrefslogtreecommitdiffstats
path: root/tools/test_common.rb
blob: 9959f55dedaebded1d3d97b8bc2ef0ae305d447e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

if ENV["BUILDKITE"]
  require "minitest/reporters"
  require "fileutils"

  module Minitest
    def self.plugin_rails_ci_junit_format_test_report_for_buildkite_init(*)
      dir = File.join(__dir__, "../test-reports/#{ENV['BUILDKITE_JOB_ID']}")
      reporter << Minitest::Reporters::JUnitReporter.new(dir, false)
      FileUtils.mkdir_p(dir)
    end
  end

  Minitest.load_plugins
  Minitest.extensions.unshift "rails_ci_junit_format_test_report_for_buildkite"
end