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 reading .rspec_parallel #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions lib/turbo_tests/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def run
group_opts[:group_by] = :filesize
end

options_file = [".rspec_parallel", "spec/parallel_spec.opts", "spec/spec.opts"].detect { |f| File.file?(f) }

tests_in_groups =
ParallelTests::RSpec::Runner.tests_in_groups(
@files,
Expand All @@ -87,7 +89,8 @@ def run
setup_tmp_dir

subprocess_opts = {
record_runtime: use_runtime_info
record_runtime: use_runtime_info,
options_file: options_file
}

report_number_of_tests(tests_in_groups)
Expand Down Expand Up @@ -130,7 +133,7 @@ def start_regular_subprocess(tests, process_id, **opts)
)
end

def start_subprocess(env, extra_args, tests, process_id, record_runtime:)
def start_subprocess(env, extra_args, tests, process_id, record_runtime:, options_file:)
if tests.empty?
@messages << {
type: "exit",
Expand All @@ -157,13 +160,16 @@ def start_subprocess(env, extra_args, tests, process_id, record_runtime:)
[]
end

spec_opts = ["-O", options_file] if options_file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use parallel-tests directly.

Suggested change
spec_opts = ["-O", options_file] if options_file
spec_opts = ParallelTests::RSpec::Runner.send(:spec_opts)


command = [
"rspec",
*extra_args,
"--seed", @seed,
"--format", "TurboTests::JsonRowsFormatter",
"--out", tmp_filename,
*record_runtime_options,
*spec_opts,
*tests
]
command.unshift(ENV["BUNDLE_BIN_PATH"], "exec") if ENV["BUNDLE_BIN_PATH"]
Expand Down