Replies: 1 comment
|
I think this concept could be generalized further: if the number of tests to be run after applying all filters (even when multiple files or lines are specified) falls below the parallelization threshold, parallelization should be automatically disabled. For example, running |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
When running a single test using a line filter:
bin/rails test test/controllers/foo_test.rb:24Rails still enables parallelization if the test file contains more than the configured threshold (default: 50 tests).
This happens because the decision to enable parallelization is based on the total number of test methods in the test class, rather than the number of tests that will actually be executed after filtering (I think, not sure).
As a result:
test-0,test-1, ...)Expected behavior
When the test run is effectively targeting a single test (e.g. via
file:line), parallelization should be disabled automatically.Current behavior
Parallelization is enabled if the total number of test methods in the test class exceeds the configured threshold, regardless of runtime filtering.
Proposal
Detect when the test run is scoped to a single test (e.g. via line filter) and force:
This could be implemented by:
Example
Given a test file with 100 test methods:
bin/rails test test/models/user_test.rb:42Current behavior:
Proposed behavior:
Notes
Alternatives considered
PARALLEL_WORKERS=1):lineusageThese approaches work but require manual intervention and are not discoverable.
All reactions