Method: TestCenter::Helper::CorrectingScanHelper#collate_reports

Defined in:
lib/fastlane/plugin/retry_tests/helper/correcting_scan_helper.rb

#collate_reports(output_directory, reportnamer) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/fastlane/plugin/retry_tests/helper/correcting_scan_helper.rb', line 81

def collate_reports(output_directory, reportnamer)
  report_files = Dir.glob("#{output_directory}/*#{reportnamer.junit_filextension}").map do |relative_filepath|
    File.absolute_path(relative_filepath)
  end
  if report_files.size > 1
    config = FastlaneCore::Configuration.create(
      Fastlane::Actions::CollateJunitReportsAction.available_options,
      {
        reports: report_files.sort { |f1, f2| File.mtime(f1) <=> File.mtime(f2) },
        collated_report: File.absolute_path(File.join(output_directory, reportnamer.junit_reportname))
      }
    )
    Fastlane::Actions::CollateJunitReportsAction.run(config)
  end
  retried_junit_reportfiles = Dir.glob("#{output_directory}/**/*-[1-9]*#{reportnamer.junit_filextension}")
  FileUtils.rm_f(retried_junit_reportfiles)
end