Module: TestProf::Autopilot::Patches::TagProfPatch

Defined in:
lib/test_prof/autopilot/patches/tag_prof_patch.rb

Overview

Monkey-patch for ‘TestProf::TagProf::RSpecListener’. Redefined ‘report’ method provides writing artifact to the directory instead of printing report

Constant Summary collapse

ARTIFACT_FILE =
"tag_prof_report.json"

Class Method Summary collapse

Class Method Details

.patchObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/test_prof/autopilot/patches/tag_prof_patch.rb', line 12

def patch
  TestProf::TagProf::RSpecListener.class_eval do
    def report
      dir_path = FileUtils.mkdir_p(Autopilot.config.tmp_dir)[0]
      file_path = File.join(dir_path, ARTIFACT_FILE)

      File.write(file_path, result.to_json)
    end
  end
end