From 8f5c91f9e4e60989fc7c45afbd255e5e7dcb99e7 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 6 Sep 2024 20:42:38 +0100 Subject: [PATCH] wip --- src/Plugins/Mutate.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Plugins/Mutate.php b/src/Plugins/Mutate.php index 87a4c27..6b4a241 100644 --- a/src/Plugins/Mutate.php +++ b/src/Plugins/Mutate.php @@ -156,7 +156,9 @@ public function addOutput(int $exitCode): int $configurationRepository = Container::getInstance()->get(ConfigurationRepository::class); $configuration = $configurationRepository->mergedConfiguration(); - if ($configuration->classes === [] && ! $configuration->everything) { + $paths = $configurationRepository->cliConfiguration->toArray()['paths'] ?? false; + + if (! is_array($paths) && $configuration->classes === [] && ! $configuration->everything) { $this->output->writeln([' ERROR Mutation testing requires the usage of the `covers()` function. Here is an example:', '']); $highlighter = new Highlighter; @@ -170,7 +172,15 @@ public function addOutput(int $exitCode): int $this->output->writeln($content); - $this->output->writeln(['', ' INFO Optionally, you can use the `pest --everything --covered-only` flags for generating mutations for "covered" classes, but this is not recommended as it will slow down the mutation testing process.', '']); + $this->output->writeln(['', ' INFO Optionally, you can use mutation testing with our filters:', '']); + + $this->output->writeln([ + ' pest --mutate --parallel --path=app/Models', + ' pest --mutate --parallel --class=App\\Models', + ' pest --mutate --parallel --everything --covered-only', + ]); + + $this->output->writeln(['', ' However, we recommend using the `covers()` function for better performance, and keep tracking of your mutation testing score.', '']); return 1; }