Skip to content

Commit

Permalink
Support reading .rspec_parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 authored and pboling committed Jan 14, 2025
1 parent 4d3d0b3 commit e8e985a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/turbo_tests/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def run
ParallelTests::RSpec::Runner.tests_with_size(@files, {}).size,
].min

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 @@ -108,6 +110,7 @@ def run

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

@reporter.report(tests_in_groups) do |_reporter|
Expand Down Expand Up @@ -151,7 +154,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 Down Expand Up @@ -188,16 +191,18 @@ def start_subprocess(env, extra_args, tests, process_id, record_runtime:)
[]
end

spec_opts = ["-O", options_file] if options_file

command = [
*command_name,
*extra_args,
*seed_option,
"--format",
"TurboTests::JsonRowsFormatter",
*record_runtime_options,
*spec_opts,
*tests,
]
command.unshift(ENV["BUNDLE_BIN_PATH"], "exec") if ENV["BUNDLE_BIN_PATH"]
command.unshift("nice") if @nice

if @verbose
Expand Down

0 comments on commit e8e985a

Please sign in to comment.