Skip to content

Commit 4425e06

Browse files
Restore back options --verbose-process-command and --verbose-rerun-command (grosser#952)
* Restore back options --verbose-process-command and --verbose-rerun-command implements issue grosser#951 * Reference Github PR in Changelog * Remove :verbose_command option It's now just an alias to --verbose-process-command and --verbose-rerun-command combined.
1 parent 1d93947 commit 4425e06

File tree

6 files changed

+40
-7
lines changed

6 files changed

+40
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22

33
## Unreleased
4+
- Restored the `--verbose-process-command` and `--verbose-rerun-command` options, removed in version 4.0.0.
5+
See [#952](https://github.com/grosser/parallel_tests/pull/952).
6+
`--verbose-command` continues to be supported and is equivalent to set the 2 options above.
47

58
### Breaking Changes
69

Readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ Options are:
284284
--first-is-1 Use "1" as TEST_ENV_NUMBER to not reuse the default test environment
285285
--fail-fast Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported
286286
--verbose Print debug output
287-
--verbose-command Displays the command that will be executed by each process and when there are failures displays the command executed by each process that failed
287+
--verbose-command Combines options --verbose-process-command and --verbose-rerun-command
288+
--verbose-process-command Print the command that will be executed by each process before it begins
289+
--verbose-rerun-command After a process fails, print the command executed by that process
288290
--quiet Print only tests output
289291
-v, --version Show Version
290292
-h, --help Show this.

lib/parallel_tests/cli.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def report_failure_rerun_commmand(test_results, options)
146146
failing_sets = test_results.reject { |r| r[:exit_status] == 0 }
147147
return if failing_sets.none?
148148

149-
if options[:verbose] || options[:verbose_command]
149+
if options[:verbose] || options[:verbose_rerun_command]
150150
puts "\n\nTests have failed for a parallel_test group. Use the following command to run the group again:\n\n"
151151
failing_sets.each do |failing_set|
152152
command = failing_set[:command]
@@ -291,7 +291,9 @@ def parse_options!(argv)
291291
opts.on("--first-is-1", "Use \"1\" as TEST_ENV_NUMBER to not reuse the default test environment") { options[:first_is_1] = true }
292292
opts.on("--fail-fast", "Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported") { options[:fail_fast] = true }
293293
opts.on("--verbose", "Print debug output") { options[:verbose] = true }
294-
opts.on("--verbose-command", "Displays the command that will be executed by each process and when there are failures displays the command executed by each process that failed") { options[:verbose_command] = true }
294+
opts.on("--verbose-command", "Combines options --verbose-process-command and --verbose-rerun-command") { options.merge! verbose_process_command: true, verbose_rerun_command: true }
295+
opts.on("--verbose-process-command", "Print the command that will be executed by each process before it begins") { options[:verbose_process_command] = true }
296+
opts.on("--verbose-rerun-command", "After a process fails, print the command executed by that process") { options[:verbose_rerun_command] = true }
295297
opts.on("--quiet", "Print only tests output") { options[:quiet] = true }
296298
opts.on("-v", "--version", "Show Version") do
297299
puts ParallelTests::VERSION

lib/parallel_tests/test/runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def set_unknown_runtime(tests, options)
293293
end
294294

295295
def report_process_command?(options)
296-
options[:verbose] || options[:verbose_command]
296+
options[:verbose] || options[:verbose_process_command]
297297
end
298298
end
299299
end

spec/integration_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,20 @@ def test_unicode
241241
expect(result).to include "bundle exec rspec spec/xxx2_spec.rb"
242242
end
243243

244+
it "shows only rerun with --verbose-rerun-command" do
245+
write 'spec/xxx_spec.rb', 'describe("it"){it("should"){expect(1).to eq(2)}}'
246+
result = run_tests ["spec", "--verbose-rerun-command"], type: 'rspec', fail: true
247+
expect(result).to match printed_rerun
248+
expect(result).to_not match printed_commands
249+
end
250+
251+
it "shows only process with --verbose-process-command" do
252+
write 'spec/xxx_spec.rb', 'describe("it"){it("should"){expect(1).to eq(2)}}'
253+
result = run_tests ["spec", "--verbose-process-command"], type: 'rspec', fail: true
254+
expect(result).to_not match printed_rerun
255+
expect(result).to match printed_commands
256+
end
257+
244258
it "fails when tests fail" do
245259
write 'spec/xxx_spec.rb', 'describe("it"){it("should"){puts "TEST1"}}'
246260
write 'spec/xxx2_spec.rb', 'describe("it"){it("should"){expect(1).to eq(2)}}'

spec/parallel_tests/cli_spec.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,19 @@ def call(*args)
5757

5858
it "parses --verbose-command" do
5959
expect(call(['test', '--verbose-command'])).to eq(
60-
defaults.merge(verbose_command: true)
60+
defaults.merge(verbose_process_command: true, verbose_rerun_command: true)
61+
)
62+
end
63+
64+
it "parses --verbose-process-command" do
65+
expect(call(['test', '--verbose-process-command'])).to eq(
66+
defaults.merge(verbose_process_command: true)
67+
)
68+
end
69+
70+
it "parses --verbose-rerun-command" do
71+
expect(call(['test', '--verbose-rerun-command'])).to eq(
72+
defaults.merge(verbose_rerun_command: true)
6173
)
6274
end
6375

@@ -239,10 +251,10 @@ def self.it_prints_nothing_about_rerun_commands(options)
239251
it_prints_nothing_about_rerun_commands(verbose: false)
240252
end
241253

242-
context "with verbose command" do
254+
context "with verbose rerun command" do
243255
it "prints command if there is a failure" do
244256
expect do
245-
subject.send(:report_failure_rerun_commmand, single_failed_command, verbose_command: true)
257+
subject.send(:report_failure_rerun_commmand, single_failed_command, verbose_rerun_command: true)
246258
end.to output("\n\nTests have failed for a parallel_test group. Use the following command to run the group again:\n\nTEST_ENV_NUMBER= PARALLEL_TEST_GROUPS= foo\n").to_stdout
247259
end
248260
end

0 commit comments

Comments
 (0)