Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/simplecov/command_guesser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class << self
attr_accessor :original_run_command

def guess
from_env || from_command_line_options || from_defined_constants
[from_command_line_options || from_defined_constants, parallel_data].compact.join(" ")
end

private

def from_env
def parallel_data
# If being run from inside parallel_tests set the command name according to the process number
return unless ENV["PARALLEL_TEST_GROUPS"] && ENV["TEST_ENV_NUMBER"]

Expand Down
7 changes: 7 additions & 0 deletions spec/command_guesser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,11 @@
subject.original_run_command = "some_arbitrary_command with arguments"
expect(subject.guess).to eq("RSpec")
end

it "appends parallel data" do
subject.original_run_command = "/some/path/spec/foo.rb"
expect(ENV).to receive(:[]).with("TEST_ENV_NUMBER").at_least(:once).and_return("1")
expect(ENV).to receive(:[]).with("PARALLEL_TEST_GROUPS").at_least(:once).and_return("2")
expect(subject.guess).to eq("RSpec (1/2)")
end
end