diff --git a/src/Codeception/Coverage/Filter.php b/src/Codeception/Coverage/Filter.php index c1c2d2067f..922ebcf355 100644 --- a/src/Codeception/Coverage/Filter.php +++ b/src/Codeception/Coverage/Filter.php @@ -4,6 +4,7 @@ use Codeception\Configuration; use Codeception\Exception\ConfigurationException; use Codeception\Exception\ModuleException; +use Symfony\Component\Finder\Exception\DirectoryNotFoundException; use Symfony\Component\Finder\Finder; class Filter @@ -91,12 +92,16 @@ public function whiteList($config) throw new ConfigurationException('Error parsing yaml. Config `whitelist: exclude:` should be an array'); } foreach ($coverage['whitelist']['exclude'] as $fileOrDir) { - $finder = strpos($fileOrDir, '*') === false - ? [Configuration::projectDir() . DIRECTORY_SEPARATOR . $fileOrDir] - : $this->matchWildcardPattern($fileOrDir); + try { + $finder = strpos($fileOrDir, '*') === false + ? [Configuration::projectDir() . DIRECTORY_SEPARATOR . $fileOrDir] + : $this->matchWildcardPattern($fileOrDir); - foreach ($finder as $file) { - $filter->removeFileFromWhitelist($file); + foreach ($finder as $file) { + $filter->removeFileFromWhitelist($file); + } + } catch (DirectoryNotFoundException $e) { + continue; } } }