class ParallelTests::CLI
def run_tests_in_parallel(num_processes, options)
def run_tests_in_parallel(num_processes, options) test_results = nil run_tests_proc = -> do groups = @runner.tests_in_groups(options[:files], num_processes, options) groups.reject!(&:empty?) if options[:only_group] groups = options[:only_group].map { |i| groups[i - 1] }.compact num_processes = 1 end report_number_of_tests(groups) unless options[:quiet] test_results = execute_in_parallel(groups, groups.size, options) do |group, index| run_tests(group, index, num_processes, options) end report_results(test_results, options) unless options[:quiet] end if options[:quiet] run_tests_proc.call else report_time_taken(&run_tests_proc) end if any_test_failed?(test_results) warn final_fail_message exit_status = if options[:failure_exit_code] options[:failure_exit_code] elsif options[:highest_exit_status] test_results.map { |data| data.fetch(:exit_status) }.max else 1 end exit exit_status end end