Skip to content

Commit

Permalink
Merge pull request #5719 from Mitrichius/5485-coverage-ignore-not-exi…
Browse files Browse the repository at this point in the history
…sting-dir

coverage: do not fail when excluded directory not exists
  • Loading branch information
Naktibalda committed Oct 18, 2019
2 parents 48e08e0 + 8cb4a93 commit 50907be
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Codeception/Coverage/Filter.php
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 50907be

Please sign in to comment.