From 3c91bf4ad2b692d6f3a9bf79bd91e779f5f59fde Mon Sep 17 00:00:00 2001 From: nuno maduro Date: Thu, 30 Apr 2026 20:51:57 +0100 Subject: [PATCH] wip --- src/Exceptions/NoAffectedTestsFound.php | 38 +++++++++++++++++++++++++ src/Plugins/Tia.php | 6 ++++ 2 files changed, 44 insertions(+) create mode 100644 src/Exceptions/NoAffectedTestsFound.php diff --git a/src/Exceptions/NoAffectedTestsFound.php b/src/Exceptions/NoAffectedTestsFound.php new file mode 100644 index 00000000..29b144bd --- /dev/null +++ b/src/Exceptions/NoAffectedTestsFound.php @@ -0,0 +1,38 @@ +writeln([ + '', + ' INFO No affected tests found.', + '', + ]); + } + + /** + * The exit code to be used. + */ + public function exitCode(): int + { + return 0; + } +} diff --git a/src/Plugins/Tia.php b/src/Plugins/Tia.php index ce1619f6..161b68ec 100644 --- a/src/Plugins/Tia.php +++ b/src/Plugins/Tia.php @@ -19,6 +19,8 @@ use Pest\Plugins\Tia\Recorder; use Pest\Plugins\Tia\ResultCollector; use Pest\Plugins\Tia\TableExtractor; use Pest\Plugins\Tia\WatchPatterns; +use Pest\Exceptions\NoAffectedTestsFound; +use Pest\Panic; use Pest\Support\Container; use Pest\TestCaseFilters\TiaTestCaseFilter; use Pest\TestSuite; @@ -705,6 +707,10 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable $this->registerRecap(); if ($this->filteredMode) { + if ($affected === []) { + Panic::with(new NoAffectedTestsFound); + } + TestSuite::getInstance()->tests->addTestCaseFilter( new TiaTestCaseFilter($projectRoot, $graph, $affectedSet), );