Skip to content

rspec-conductor Support - #1259

Merged
sferik merged 3 commits into
mainfrom
rspec-conductor-support
Aug 11, 2026
Merged

rspec-conductor Support#1259
sferik merged 3 commits into
mainfrom
rspec-conductor-support

Conversation

@sferik

@sferik sferik commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

rspec-conductor already works with SimpleCov out of the box, so this PR locks that in with end-to-end tests and documentation rather than new runtime code.

No runtime change was needed because of two things that happened after #1156 was filed: three days later, rspec-conductor 1.0.7 started exporting PARALLEL_TEST_GROUPS alongside the TEST_ENV_NUMBER it always set per worker. Then the pluggable parallel adapter interface landed with GenericAdapter, which activates on that env-var convention. As a result, a conductor run records each worker under a unique suite name (RSpec (1/2), RSpec (2/2)) and the first worker waits for its siblings and builds the merged report, with zero configuration.

This PR adds a rspec_conductor test project (mirroring the parallel_tests one, with rspec-conductor in its Gemfile) and a cucumber feature with four scenarios: a default 2-worker run matching a plain rspec run, the --first-is-1 numbering mode, branch coverage, and threshold checks deferred until the merged report. The scenarios are tagged @process_fork because conductor forks its workers, which JRuby cannot do. They assert on the generated report files instead of the usual "Coverage report generated" output line, because the reporting worker prints that line from its at_exit hook after it has already sent its run summary, and the conductor server does not forward worker output arriving that late. The docs in Parallelism.md and the adapter source comments now name rspec-conductor (1.0.7 or later) among the runners the generic adapter covers, so users searching for it can find the answer. Users on earlier versions still need the manual command_name workaround, because those versions do not export the worker count.

rspec-conductor marks each forked worker with the parallel_tests
environment convention, TEST_ENV_NUMBER per worker plus
PARALLEL_TEST_GROUPS for the worker count (since rspec-conductor 1.0.7).
SimpleCov's generic parallel adapter already recognizes that convention,
so coverage from a conductor run merges into one report with unique
suite names per worker and no configuration.

Lock that support in with a dedicated test project and cucumber feature
covering the default numbering (first worker ""), the --first-is-1
numbering, branch coverage, and threshold checks deferred to the merged
report. Name rspec-conductor in the adapter docs so users can find it.

Resolves #1156.
@sferik
sferik requested a balanced review from Copilot August 11, 2026 18:45

This comment was marked as low quality.

This comment was marked as resolved.

sferik added 2 commits August 11, 2026 15:07
…ctor features

The rspec_conductor test project was a byte-for-byte copy of the
parallel_tests one, differing only in which parallel runner its Gemfile
pulls in, and its feature repeated the expected coverage tables inline
three times. Any change to the fixture sources would have required
updating five copies of the tables and ten duplicated files.

Slim test_projects/rspec_conductor down to its Gemfile and Gemfile.lock.
A new setup step overlays those onto another project's sources, so the
conductor feature now runs against the parallel_tests fixture itself.
Rename the shared assertion steps to "the parallel fixture project"
(and their file to parallel_fixture_steps.rb) since they no longer
belong to a single feature, and reuse them in place of the inline
tables.
rspec-conductor closes each worker's output pipes as soon as the worker
has sent its run summary to the server, before the worker's at_exit
hooks run. SimpleCov's exit tasks then died half way: the HTML and JSON
report files were already written, but emitting the status line probes
Color.enabled?, whose IO#tty? call raises IOError on a closed stream.
That exception aborted the rest of the at_exit work, so the minimum and
maximum coverage checks silently never ran under rspec-conductor, and
.last_run.json and the .report_stamp deferral marker were never written.

Treat a closed stream as not a tty in Color.enabled?, and drop the
status line in Formatter::Base#emit_status and the violation report in
ExitCodes.print_error when stderr is closed, instead of letting the
IOError cancel the threshold checks that follow.

The conductor feature's threshold scenario previously asserted that no
violation appears in the output, which the closed pipes made vacuous:
the text could never appear, and the swallowed worker exit status meant
the run always succeeded. It now asserts that .last_run.json carries
the merged 81.48. SimpleCov writes that file only when the threshold
check passes, and every single worker's partial slice is below the
threshold, so the file proves the check ran against the merged result.
@sferik
sferik merged commit f48d562 into main Aug 11, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants