Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parallel_tests with multiple commands #1022

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
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