mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: coverage lines
This commit is contained in:
@ -104,6 +104,15 @@ final class Coverage
|
||||
? '100.0'
|
||||
: number_format($file->percentageOfExecutedLines()->asFloat(), 1, '.', '');
|
||||
|
||||
$uncoveredLines = '';
|
||||
|
||||
$percentageOfExecutedLinesAsString = $file->percentageOfExecutedLines()->asString();
|
||||
|
||||
if (! in_array($percentageOfExecutedLinesAsString, ['0.00%', '100.00%', '100.0%', ''], true)) {
|
||||
$uncoveredLines = trim(implode(', ', self::getMissingCoverage($file)));
|
||||
$uncoveredLines = sprintf('<span>%s</span>', $uncoveredLines).' <span class="text-gray"> / </span>';
|
||||
}
|
||||
|
||||
$color = $percentage === '100.0' ? 'green' : ($percentage === '0.0' ? 'red' : 'yellow');
|
||||
|
||||
$truncateAt = max(1, terminal()->width() - 12);
|
||||
@ -113,7 +122,7 @@ final class Coverage
|
||||
<div class="flex mx-2">
|
||||
<span class="truncate-{$truncateAt}">{$name}</span>
|
||||
<span class="flex-1 content-repeat-[.] text-gray mx-1"></span>
|
||||
<span class="text-{$color}">{$percentage}%</span>
|
||||
<span class="text-{$color}">$uncoveredLines {$percentage}%</span>
|
||||
</div>
|
||||
HTML);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user