Skip to content

Commit

Permalink
Merge pull request #6 from VitalConnectInc/pull-45
Browse files Browse the repository at this point in the history
Support reading `.rspec_parallel`
  • Loading branch information
pboling authored Jan 14, 2025
2 parents 4d3d0b3 + 9f2cece commit 588cd37
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .rubocop_gradual.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"lib/turbo_tests/reporter.rb:1386902608": [
[7, 5, 400, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2092085575]
],
"lib/turbo_tests/runner.rb:1092969829": [
"lib/turbo_tests/runner.rb:3421474245": [
[13, 5, 271, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 21989008],
[20, 5, 1311, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1925027850],
[216, 11, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[234, 47, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163],
[236, 21, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[245, 7, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[305, 9, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952]
[221, 11, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[239, 47, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163],
[241, 21, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[250, 7, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[310, 9, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952]
],
"spec/cli_spec.rb:3990998076": [
[1, 1, 30, "RSpec/SpecFilePathFormat: Spec path should end with `turbo_tests/cli*_spec.rb`.", 965721356],
Expand Down
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 588cd37

Please sign in to comment.