lib/scan/runner.rb in scan-0.5.0 vs lib/scan/runner.rb in scan-0.5.1

- old
+ new

@@ -4,12 +4,11 @@ require 'terminal-table' module Scan class Runner def run - test_app - handle_results + handle_results(test_app) end def test_app command = TestCommandGenerator.generate prefix_hash = [ @@ -18,28 +17,31 @@ block: proc do |value| value.include?("Touching") end } ] + exit_status = 0 FastlaneCore::CommandExecutor.execute(command: command, print_all: true, print_command: true, prefix: prefix_hash, loading: "Loading...", error: proc do |error_output| begin + exit_status = $?.exitstatus ErrorHandler.handle_build_error(error_output) rescue => ex SlackPoster.new.run({ build_errors: 1 }) raise ex end end) + exit_status end - def handle_results + def handle_results(tests_exit_status) # First, generate a JUnit report to get the number of tests require 'tempfile' output_file = Tempfile.new("junit_report") cmd = ReportCollector.new.generate_commands(TestCommandGenerator.xcodebuild_log_path, types: 'junit', @@ -64,9 +66,10 @@ }) puts "" ReportCollector.new.parse_raw_file(TestCommandGenerator.xcodebuild_log_path) + UI.user_error!("Test execution failed. Exit status: #{tests_exit_status}") unless tests_exit_status == 0 UI.user_error!("Tests failed") unless result[:failures] == 0 end end end