Skip to content

Commit 588cd37

Browse files
authored
Merge pull request #6 from VitalConnectInc/pull-45
Support reading `.rspec_parallel`
2 parents 4d3d0b3 + 9f2cece commit 588cd37

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.rubocop_gradual.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
"lib/turbo_tests/reporter.rb:1386902608": [
2626
[7, 5, 400, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2092085575]
2727
],
28-
"lib/turbo_tests/runner.rb:1092969829": [
28+
"lib/turbo_tests/runner.rb:3421474245": [
2929
[13, 5, 271, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 21989008],
3030
[20, 5, 1311, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1925027850],
31-
[216, 11, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
32-
[234, 47, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163],
33-
[236, 21, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
34-
[245, 7, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
35-
[305, 9, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952]
31+
[221, 11, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
32+
[239, 47, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163],
33+
[241, 21, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
34+
[250, 7, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
35+
[310, 9, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952]
3636
],
3737
"spec/cli_spec.rb:3990998076": [
3838
[1, 1, 30, "RSpec/SpecFilePathFormat: Spec path should end with `turbo_tests/cli*_spec.rb`.", 965721356],

lib/turbo_tests/runner.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ def run
9797
ParallelTests::RSpec::Runner.tests_with_size(@files, {}).size,
9898
].min
9999

100+
options_file = [".rspec_parallel", "spec/parallel_spec.opts", "spec/spec.opts"].detect { |f| File.file?(f) }
101+
100102
tests_in_groups =
101103
ParallelTests::RSpec::Runner.tests_in_groups(
102104
@files,
@@ -108,6 +110,7 @@ def run
108110

109111
subprocess_opts = {
110112
record_runtime: @record_runtime,
113+
options_file: options_file,
111114
}
112115

113116
@reporter.report(tests_in_groups) do |_reporter|
@@ -151,7 +154,7 @@ def start_regular_subprocess(tests, process_id, **opts)
151154
)
152155
end
153156

154-
def start_subprocess(env, extra_args, tests, process_id, record_runtime:)
157+
def start_subprocess(env, extra_args, tests, process_id, record_runtime:, options_file:)
155158
if tests.empty?
156159
@messages << {
157160
type: "exit",
@@ -188,16 +191,18 @@ def start_subprocess(env, extra_args, tests, process_id, record_runtime:)
188191
[]
189192
end
190193

194+
spec_opts = ["-O", options_file] if options_file
195+
191196
command = [
192197
*command_name,
193198
*extra_args,
194199
*seed_option,
195200
"--format",
196201
"TurboTests::JsonRowsFormatter",
197202
*record_runtime_options,
203+
*spec_opts,
198204
*tests,
199205
]
200-
command.unshift(ENV["BUNDLE_BIN_PATH"], "exec") if ENV["BUNDLE_BIN_PATH"]
201206
command.unshift("nice") if @nice
202207

203208
if @verbose

0 commit comments

Comments
 (0)