lib/parallel_tests/cli.rb in parallel_tests-2.2.2 vs lib/parallel_tests/cli.rb in parallel_tests-2.3.0

- old
+ new

@@ -11,10 +11,12 @@ ENV['DISABLE_SPRING'] ||= '1' num_processes = ParallelTests.determine_number_of_processes(options[:count]) num_processes = num_processes * (options[:multiply] || 1) + options[:first_is_1] ||= first_is_1? + if options[:execute] execute_shell_command_in_parallel(options[:execute], num_processes, options) else run_tests_in_parallel(num_processes, options) end @@ -188,10 +190,11 @@ opts.on('--ignore-tags [PATTERN]', 'When counting steps ignore scenarios with tags that match this pattern') { |arg| options[:ignore_tag_pattern] = arg } 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("--verbose", "Print more output") { options[:verbose] = true } opts.on("-v", "--version", "Show Version") { puts ParallelTests::VERSION; exit } opts.on("-h", "--help", "Show this.") { puts opts; exit } end.parse!(argv) @@ -283,8 +286,13 @@ fail_message end def use_colors? $stdout.tty? + end + + def first_is_1? + val = ENV["PARALLEL_TEST_FIRST_IS_1"] + ['1', 'true'].include?(val) end end end