lib/parallel_tests/cli.rb in parallel_tests-4.6.0 vs lib/parallel_tests/cli.rb in parallel_tests-4.6.1
- old
+ new
@@ -55,12 +55,12 @@
def execute_in_parallel(items, num_processes, options)
Tempfile.open 'parallel_tests-lock' do |lock|
ParallelTests.with_pid_file do
simulate_output_for_ci options[:serialize_stdout] do
- Parallel.map(items, in_threads: num_processes) do |item|
- result = yield(item)
+ Parallel.map_with_index(items, in_threads: num_processes) do |item, index|
+ result = yield(item, index)
reprint_output(result, lock.path) if options[:serialize_stdout]
ParallelTests.stop_all_processes if options[:fail_fast] && result[:exit_status] != 0
result
end
end
@@ -79,11 +79,11 @@
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|
- run_tests(group, groups.index(group), num_processes, options)
+ 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]