lib/parallel_tests/cli.rb in parallel_tests-3.0.0 vs lib/parallel_tests/cli.rb in parallel_tests-3.1.0

- old
+ new

@@ -40,13 +40,14 @@ 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| + Parallel.map(items, in_threads: num_processes) do |item| result = yield(item) reprint_output(result, lock.path) if options[:serialize_stdout] + ParallelTests.stop_all_processes if options[:fail_fast] && result[:exit_status] != 0 result end end end end @@ -218,9 +219,10 @@ opts.on("--nice", "execute test commands with low priority.") { options[:nice] = true } opts.on("--runtime-log [PATH]", "Location of previously recorded test runtimes") { |path| options[:runtime_log] = path } opts.on("--allowed-missing [INT]", Integer, "Allowed percentage of missing runtimes (default = 50)") { |percent| options[:allowed_missing_percent] = percent } opts.on("--unknown-runtime [FLOAT]", Float, "Use given number as unknown runtime (otherwise use average time)") { |time| options[:unknown_runtime] = time } opts.on("--first-is-1", "Use \"1\" as TEST_ENV_NUMBER to not reuse the default test environment") { options[:first_is_1] = true } + opts.on("--fail-fast", "Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported") { options[:fail_fast] = true } opts.on("--verbose", "Print debug output") { options[:verbose] = true } opts.on("--verbose-process-command", "Displays only the command that will be executed by each process") { options[:verbose_process_command] = true } opts.on("--verbose-rerun-command", "When there are failures, displays the command executed by each process that failed") { options[:verbose_rerun_command] = true } opts.on("--quiet", "Print only tests output") { options[:quiet] = true } opts.on("-v", "--version", "Show Version") { puts ParallelTests::VERSION; exit }