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

Don't require simplecov when running a bundled env #476

Merged
merged 1 commit into from
Jul 25, 2018
Merged
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
2 changes: 1 addition & 1 deletion test/minitest_runner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_with_seed_option

def run_minitest_runner(*args)
out, = capture_subprocess_io do
assert_equal true, system(shell_out_env, *binstub, *args)
assert_equal true, system(shell_out_env(simplecov: false), *binstub, *args)
end

out
Expand Down
13 changes: 9 additions & 4 deletions test/support/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,24 @@ def run_byebug(*args, input: "")
# Common environment shared by specs that shell out. It needs to:
#
# * Adds byebug to the LOAD_PATH.
# * Setup coverage tracking so that coverage in the subprocess is tracked.
# * (Optionally) Setup coverage tracking so that coverage in the subprocess
# is tracked.
#
def shell_out_env
def shell_out_env(simplecov: true)
minitest_test = Thread.current.backtrace_locations.find do |location|
location.label.start_with?("test_")
end

byebug_dir = File.absolute_path(File.join("..", "..", "lib"), __dir__)

{
base = {
"MINITEST_TEST" => "#{self.class}##{minitest_test.label}",
"RUBYOPT" => "-r simplecov -I #{byebug_dir}"
"RUBYOPT" => "-I #{byebug_dir}"
}

base["RUBYOPT"] += " -r simplecov" if simplecov

base
end

#
Expand Down