Skip to content

Commit

Permalink
simplify options
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Apr 23, 2024
1 parent 185faa4 commit 9de9782
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 5 additions & 7 deletions Readme.md
Expand Up @@ -250,10 +250,9 @@ Options are:
-m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
-s, --single [PATTERN] Run all matching files in the same process
-i, --isolate Do not run any other tests in the group used by --single(-s)
--isolate-n [PROCESSES] Use 'isolate' singles with number of processes, default: 1.
--isolate-n [PROCESSES] Use 'isolate' singles with number of processes, default: 1
--highest-exit-status Exit with the highest exit status provided by test run(s)
If failure-exit-code is specified, that value takes priority.
--failure-exit-code [INT] Specify the exit code to use when tests fail.
--failure-exit-code [INT] Specify the exit code to use when tests fail
--specify-groups [SPECS] Use 'specify-groups' if you want to specify multiple specs running in multiple
processes in a specific formation. Commas indicate specs in the same process,
pipes indicate specs in a new process. Cannot use with --single, --isolate, or
Expand All @@ -262,9 +261,8 @@ Options are:
Process 1 will contain 1_spec.rb and 2_spec.rb
Process 2 will contain 3_spec.rb
Process 3 will contain all other specs
--only-group INT[,INT] Only run the given group numbers. Note that this will force the 'filesize'
grouping strategy (even when the runtime log is present) unless you explicitly
set it otherwise via the '-group-by' flag.
--only-group INT[,INT] Only run the given group numbers.
Changes `--group-by` default to 'filesize'.
-e, --exec [COMMAND] execute this code parallel and with ENV['TEST_ENV_NUMBER']
-o, --test-options '[OPTIONS]' execute test commands with those options
-t, --type [TYPE] test(default) / rspec / cucumber / spinach
Expand All @@ -281,7 +279,7 @@ Options are:
--nice execute test commands with low priority.
--runtime-log [PATH] Location of previously recorded test runtimes
--allowed-missing [INT] Allowed percentage of missing runtimes (default = 50)
--allow-duplicates When detecting files to run, allow duplicates. Useful for local debugging
--allow-duplicates When detecting files to run, allow duplicates
--unknown-runtime [FLOAT] Use given number as unknown runtime (otherwise use average time)
--first-is-1 Use "1" as TEST_ENV_NUMBER to not reuse the default test environment
--fail-fast Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported
Expand Down
13 changes: 7 additions & 6 deletions lib/parallel_tests/cli.rb
Expand Up @@ -224,15 +224,12 @@ def parse_options!(argv)
opts.on(
"--isolate-n [PROCESSES]",
Integer,
"Use 'isolate' singles with number of processes, default: 1."
"Use 'isolate' singles with number of processes, default: 1"
) { |n| options[:isolate_count] = n }

opts.on(
"--highest-exit-status",
<<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
Exit with the highest exit status provided by test run(s)
If failure-exit-code is specified, that value takes priority.
TEXT
"Exit with the highest exit status provided by test run(s)"
) { options[:highest_exit_status] = true }

opts.on(
Expand All @@ -248,7 +245,7 @@ def parse_options!(argv)
processes in a specific formation. Commas indicate specs in the same process,
pipes indicate specs in a new process. Cannot use with --single, --isolate, or
--isolate-n. Ex.
$ parallel_test -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
$ parallel_tests -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
Process 1 will contain 1_spec.rb and 2_spec.rb
Process 2 will contain 3_spec.rb
Process 3 will contain all other specs
Expand Down Expand Up @@ -342,6 +339,10 @@ def parse_options!(argv)
raise "Can't pass --specify-groups with any of these keys: --single, --isolate, or --isolate-n"
end

if options[:failure_exit_code] && options[:highest_exit_status]
raise "Can't pass --failure-exit-code and --highest-exit-status"
end

options
end

Expand Down

0 comments on commit 9de9782

Please sign in to comment.