mirror of
https://github.com/pestphp/pest.git
synced 2026-04-21 06:27:28 +02:00
removes time balanced
This commit is contained in:
@ -34,8 +34,7 @@ final class Shard implements AddsOutput, HandlesArguments, Terminable
|
|||||||
* index: int,
|
* index: int,
|
||||||
* total: int,
|
* total: int,
|
||||||
* testsRan: int,
|
* testsRan: int,
|
||||||
* testsCount: int,
|
* testsCount: int
|
||||||
* estimatedTime: float|null
|
|
||||||
* }|null
|
* }|null
|
||||||
*/
|
*/
|
||||||
private static ?array $shard = null;
|
private static ?array $shard = null;
|
||||||
@ -136,16 +135,11 @@ final class Shard implements AddsOutput, HandlesArguments, Terminable
|
|||||||
$testsToRun = (array_chunk($tests, max(1, (int) ceil(count($tests) / $total))))[$index - 1] ?? [];
|
$testsToRun = (array_chunk($tests, max(1, (int) ceil(count($tests) / $total))))[$index - 1] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$estimatedTime = self::$timeBalanced && $timings !== null
|
|
||||||
? array_sum(array_map(fn (string $test): float => $timings[$test] ?? 0.0, $testsToRun))
|
|
||||||
: null;
|
|
||||||
|
|
||||||
self::$shard = [
|
self::$shard = [
|
||||||
'index' => $index,
|
'index' => $index,
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'testsRan' => count($testsToRun),
|
'testsRan' => count($testsToRun),
|
||||||
'testsCount' => count($tests),
|
'testsCount' => count($tests),
|
||||||
'estimatedTime' => $estimatedTime,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return [...$arguments, '--filter', $this->buildFilterArgument($testsToRun)];
|
return [...$arguments, '--filter', $this->buildFilterArgument($testsToRun)];
|
||||||
@ -247,14 +241,8 @@ final class Shard implements AddsOutput, HandlesArguments, Terminable
|
|||||||
'total' => $total,
|
'total' => $total,
|
||||||
'testsRan' => $testsRan,
|
'testsRan' => $testsRan,
|
||||||
'testsCount' => $testsCount,
|
'testsCount' => $testsCount,
|
||||||
'estimatedTime' => $estimatedTime,
|
|
||||||
] = self::$shard;
|
] = self::$shard;
|
||||||
|
|
||||||
$suffix = '';
|
|
||||||
if (self::$timeBalanced && is_float($estimatedTime)) {
|
|
||||||
$suffix = sprintf(' <fg=gray>(time-balanced, ~%.1fs)</>', $estimatedTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->output->writeln(sprintf(
|
$this->output->writeln(sprintf(
|
||||||
' <fg=gray>Shard:</> <fg=default>%d of %d</> — %d file%s ran, out of %d%s.',
|
' <fg=gray>Shard:</> <fg=default>%d of %d</> — %d file%s ran, out of %d%s.',
|
||||||
$index,
|
$index,
|
||||||
@ -262,7 +250,7 @@ final class Shard implements AddsOutput, HandlesArguments, Terminable
|
|||||||
$testsRan,
|
$testsRan,
|
||||||
$testsRan === 1 ? '' : 's',
|
$testsRan === 1 ? '' : 's',
|
||||||
$testsCount,
|
$testsCount,
|
||||||
$suffix,
|
self::$timeBalanced ? ' <fg=gray>(time-balanced)</>' : '',
|
||||||
));
|
));
|
||||||
|
|
||||||
if (self::$shardsOutdated) {
|
if (self::$shardsOutdated) {
|
||||||
|
|||||||
Reference in New Issue
Block a user