Compare commits

...

2 Commits

Author SHA1 Message Date
4a987d3d5c release: 3.7.4 2025-01-23 14:03:29 +00:00
4079a08f5f feat: adds --compact to coverage 2025-01-23 13:59:51 +00:00
6 changed files with 19 additions and 6 deletions

View File

@ -19,7 +19,7 @@
"require": { "require": {
"php": "^8.2.0", "php": "^8.2.0",
"brianium/paratest": "^7.7.0", "brianium/paratest": "^7.7.0",
"nunomaduro/collision": "^8.6.0", "nunomaduro/collision": "^8.6.1",
"nunomaduro/termwind": "^2.3.0", "nunomaduro/termwind": "^2.3.0",
"pestphp/pest-plugin": "^3.0.0", "pestphp/pest-plugin": "^3.0.0",
"pestphp/pest-plugin-arch": "^3.0.0", "pestphp/pest-plugin-arch": "^3.0.0",

View File

@ -6,7 +6,7 @@ namespace Pest;
function version(): string function version(): string
{ {
return '3.7.3'; return '3.7.4';
} }
function testDirectory(string $file = ''): string function testDirectory(string $file = ''): string

View File

@ -37,6 +37,11 @@ final class Coverage implements AddsOutput, HandlesArguments
*/ */
public bool $coverage = false; public bool $coverage = false;
/**
* Whether it should show the coverage or not.
*/
public bool $compact = false;
/** /**
* The minimum coverage. * The minimum coverage.
*/ */
@ -124,6 +129,10 @@ final class Coverage implements AddsOutput, HandlesArguments
$this->coverageExactly = (float) $exactlyOption; $this->coverageExactly = (float) $exactlyOption;
} }
if ($_SERVER['COLLISION_PRINTER_COMPACT'] ?? false) {
$this->compact = true;
}
return $originals; return $originals;
} }
@ -144,7 +153,7 @@ final class Coverage implements AddsOutput, HandlesArguments
exit(1); exit(1);
} }
$coverage = \Pest\Support\Coverage::report($this->output); $coverage = \Pest\Support\Coverage::report($this->output, $this->compact);
$exitCode = (int) ($coverage < $this->coverageMin); $exitCode = (int) ($coverage < $this->coverageMin);
if ($exitCode === 0 && $this->coverageExactly !== null) { if ($exitCode === 0 && $this->coverageExactly !== null) {

View File

@ -74,7 +74,7 @@ final class Coverage
* Reports the code coverage report to the * Reports the code coverage report to the
* console and returns the result in float. * console and returns the result in float.
*/ */
public static function report(OutputInterface $output): float public static function report(OutputInterface $output, bool $compact = false): float
{ {
if (! file_exists($reportPath = self::getPath())) { if (! file_exists($reportPath = self::getPath())) {
if (self::usingXdebug()) { if (self::usingXdebug()) {
@ -113,6 +113,10 @@ final class Coverage
? '100.0' ? '100.0'
: number_format($file->percentageOfExecutedLines()->asFloat(), 1, '.', ''); : number_format($file->percentageOfExecutedLines()->asFloat(), 1, '.', '');
if ($percentage === '100.0' && $compact) {
continue;
}
$uncoveredLines = ''; $uncoveredLines = '';
$percentageOfExecutedLinesAsString = $file->percentageOfExecutedLines()->asString(); $percentageOfExecutedLinesAsString = $file->percentageOfExecutedLines()->asString();

View File

@ -1,5 +1,5 @@
Pest Testing Framework 3.7.3. Pest Testing Framework 3.7.4.
USAGE: pest <file> [options] USAGE: pest <file> [options]

View File

@ -1,3 +1,3 @@
Pest Testing Framework 3.7.3. Pest Testing Framework 3.7.4.