Skip to content

Pluggable parallel-test-runner adapter interface#1195

Merged
sferik merged 1 commit into
mainfrom
parallel-adapter-interface
May 27, 2026
Merged

Pluggable parallel-test-runner adapter interface#1195
sferik merged 1 commit into
mainfrom
parallel-adapter-interface

Conversation

@sferik

@sferik sferik commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Coordination with parallel test runners (picking the "final" worker, waiting for siblings, knowing how many resultsets to expect) used to hard-code the parallel_tests gem. Env-var-only runners like parallel_rspec hit the wrong branch of final_result_process? and every worker thought it was the final one. They clobbered each other's resultsets.

Introduce SimpleCov::ParallelAdapters, a small registry and selection layer with a four-method contract (active?, first_worker?, wait_for_siblings, expected_worker_count). ParallelTestsAdapter wraps the historical gem API. GenericAdapter handles the env-var convention without needing any specific gem. Adapters are tried in registration order, and the first whose active? returns true is chosen. parallel_rspec works out of the box, and users with custom runners can plug in their own adapter via:

SimpleCov::ParallelAdapters.register MyAdapter

This comment was marked as resolved.

Coordination with parallel test runners (picking the "final" worker,
waiting for siblings, knowing how many resultsets to expect) used to
hard-code the parallel_tests gem. Env-var-only runners like
parallel_rspec hit the wrong branch of `final_result_process?` and every
worker thought it was the final one. They clobbered each other's
resultsets.

Introduce `SimpleCov::ParallelAdapters`, a small registry and selection
layer with a four-method contract (`active?`, `first_worker?`,
`wait_for_siblings`, `expected_worker_count`). `ParallelTestsAdapter`
wraps the historical gem API. `GenericAdapter` handles the env-var
convention without needing any specific gem. Adapters are tried in
registration order, and the first whose `active?` returns true is
chosen. parallel_rspec works out of the box, and users with custom
runners can plug in their own adapter via:

    SimpleCov::ParallelAdapters.register MyAdapter

Resolves #1065.
@sferik sferik force-pushed the parallel-adapter-interface branch from 8a4ab08 to 1144923 Compare May 27, 2026 03:39
@sferik sferik merged commit f6ec9be into main May 27, 2026
24 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