mirror of
https://github.com/pestphp/pest.git
synced 2026-06-13 06:28:24 +02:00
consistent sharding logic when no shards file (#1710)
This commit is contained in:
@ -139,7 +139,8 @@ final class Shard implements AddsOutput, HandlesArguments, Terminable
|
||||
self::$timeBalanced = true;
|
||||
self::$shardsOutdated = $newTests !== [];
|
||||
} else {
|
||||
$testsToRun = (array_chunk($tests, max(1, (int) ceil(count($tests) / $total))))[$index - 1] ?? [];
|
||||
$isInCurrentShard = fn (int $key) => $key % $total === ($index - 1);
|
||||
$testsToRun = array_values(array_filter(array_values($tests), $isInCurrentShard, ARRAY_FILTER_USE_KEY));
|
||||
}
|
||||
|
||||
self::$shard = [
|
||||
|
||||
Reference in New Issue
Block a user