File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -158,13 +158,16 @@ await AnsiConsole.Live(display.Render())
158158
159159 private static List < List < string > > SplitIntoBatches ( List < string > tests , int batchCount )
160160 {
161+ // Chunk-based: consecutive tests stay together (siblings in same worker)
161162 var batches = new List < List < string > > ( ) ;
162- for ( var i = 0 ; i < batchCount ; i ++ )
163- batches . Add ( new List < string > ( ) ) ;
163+ var chunkSize = ( tests . Count + batchCount - 1 ) / batchCount ; // Ceiling division
164164
165- // Round-robin distribution for balanced batches
166- for ( var i = 0 ; i < tests . Count ; i ++ )
167- batches [ i % batchCount ] . Add ( tests [ i ] ) ;
165+ for ( var i = 0 ; i < batchCount ; i ++ )
166+ {
167+ var start = i * chunkSize ;
168+ var count = Math . Min ( chunkSize , tests . Count - start ) ;
169+ batches . Add ( count > 0 ? tests . GetRange ( start , count ) : [ ] ) ;
170+ }
168171
169172 return batches ;
170173 }
You can’t perform that action at this time.
0 commit comments