From b0b83505af7f389db24cf61be15f43dac8f911d0 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 16 Sep 2022 19:11:59 +0100 Subject: [PATCH] Adds `--profile` --- bin/pest | 8 +++++++- src/Plugins/Coverage.php | 36 ++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/bin/pest b/bin/pest index dff09836..ac1e98b6 100755 --- a/bin/pest +++ b/bin/pest @@ -19,8 +19,10 @@ use Symfony\Component\Console\Output\OutputInterface; foreach ($args as $key => $value) { if (str_contains($value, '--compact')) { $_SERVER['COLLISION_PRINTER_COMPACT'] = 'true'; + } - break; + if (str_contains($value, '--profile')) { + $_SERVER['COLLISION_PRINTER_PROFILE'] = 'true'; } } @@ -63,6 +65,10 @@ use Symfony\Component\Console\Output\OutputInterface; if (str_contains($value, '--compact')) { unset($args[$key]); } + + if (str_contains($value, '--profile')) { + unset($args[$key]); + } } $kernel = Kernel::boot(); diff --git a/src/Plugins/Coverage.php b/src/Plugins/Coverage.php index 06315d36..e3873657 100644 --- a/src/Plugins/Coverage.php +++ b/src/Plugins/Coverage.php @@ -78,6 +78,24 @@ final class Coverage implements AddsOutput, HandlesArguments $this->coverage = true; $originals[] = '--coverage-php'; $originals[] = \Pest\Support\Coverage::getPath(); + + if (! \Pest\Support\Coverage::isAvailable()) { + if (\Pest\Support\Coverage::usingXdebug()) { + $this->output->writeln([ + '', + " ERROR Unable to get coverage using Xdebug. Did you set Xdebug's coverage mode?", + '', + ]); + } else { + $this->output->writeln([ + '', + ' ERROR No code coverage driver is available.', + '', + ]); + } + + exit(1); + } } if ($input->getOption(self::MIN_OPTION) !== null) { @@ -87,24 +105,6 @@ final class Coverage implements AddsOutput, HandlesArguments $this->coverageMin = (float) $minOption; } - if (! \Pest\Support\Coverage::isAvailable()) { - if (\Pest\Support\Coverage::usingXdebug()) { - $this->output->writeln([ - '', - " ERROR Unable to get coverage using Xdebug. Did you set Xdebug's coverage mode?", - '', - ]); - } else { - $this->output->writeln([ - '', - ' ERROR No code coverage driver is available.', - '', - ]); - } - - exit(1); - } - return $originals; }