mirror of
https://github.com/pestphp/pest.git
synced 2026-06-05 02:52:12 +02:00
wip
This commit is contained in:
38
src/Exceptions/NoAffectedTestsFound.php
Normal file
38
src/Exceptions/NoAffectedTestsFound.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Pest\Exceptions;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
|
use NunoMaduro\Collision\Contracts\RenderlessEditor;
|
||||||
|
use NunoMaduro\Collision\Contracts\RenderlessTrace;
|
||||||
|
use Pest\Contracts\Panicable;
|
||||||
|
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class NoAffectedTestsFound extends InvalidArgumentException implements ExceptionInterface, Panicable, RenderlessEditor, RenderlessTrace
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Renders the panic on the given output.
|
||||||
|
*/
|
||||||
|
public function render(OutputInterface $output): void
|
||||||
|
{
|
||||||
|
$output->writeln([
|
||||||
|
'',
|
||||||
|
' <fg=white;options=bold;bg=blue> INFO </> No affected tests found.',
|
||||||
|
'',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The exit code to be used.
|
||||||
|
*/
|
||||||
|
public function exitCode(): int
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,6 +19,8 @@ use Pest\Plugins\Tia\Recorder;
|
|||||||
use Pest\Plugins\Tia\ResultCollector;
|
use Pest\Plugins\Tia\ResultCollector;
|
||||||
use Pest\Plugins\Tia\TableExtractor;
|
use Pest\Plugins\Tia\TableExtractor;
|
||||||
use Pest\Plugins\Tia\WatchPatterns;
|
use Pest\Plugins\Tia\WatchPatterns;
|
||||||
|
use Pest\Exceptions\NoAffectedTestsFound;
|
||||||
|
use Pest\Panic;
|
||||||
use Pest\Support\Container;
|
use Pest\Support\Container;
|
||||||
use Pest\TestCaseFilters\TiaTestCaseFilter;
|
use Pest\TestCaseFilters\TiaTestCaseFilter;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
@ -705,6 +707,10 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
$this->registerRecap();
|
$this->registerRecap();
|
||||||
|
|
||||||
if ($this->filteredMode) {
|
if ($this->filteredMode) {
|
||||||
|
if ($affected === []) {
|
||||||
|
Panic::with(new NoAffectedTestsFound);
|
||||||
|
}
|
||||||
|
|
||||||
TestSuite::getInstance()->tests->addTestCaseFilter(
|
TestSuite::getInstance()->tests->addTestCaseFilter(
|
||||||
new TiaTestCaseFilter($projectRoot, $graph, $affectedSet),
|
new TiaTestCaseFilter($projectRoot, $graph, $affectedSet),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user