Skip to content

Commit

Permalink
Ingest coverage data only for the files in the filter that actually h…
Browse files Browse the repository at this point in the history
…ave some. Fixes sebastianbergmann#876
  • Loading branch information
dvdoug committed Oct 28, 2021
1 parent 3ca2f86 commit 1ae01b6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Driver/PcovDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,19 @@ public function stop(): RawCodeCoverageData
{
\pcov\stop();

$collect = \pcov\collect(
\pcov\inclusive,
!$this->filter->isEmpty() ? $this->filter->files() : \pcov\waiting()
);
$filesToCollectCoverageFor = \pcov\waiting();
$collected = [];

\pcov\clear();
if ($filesToCollectCoverageFor) {
if (!$this->filter->isEmpty()) {
$filesToCollectCoverageFor = array_intersect($filesToCollectCoverageFor, $this->filter->files());
}
$collected = \pcov\collect(\pcov\inclusive, $filesToCollectCoverageFor);

return RawCodeCoverageData::fromXdebugWithoutPathCoverage($collect);
\pcov\clear();
}

return RawCodeCoverageData::fromXdebugWithoutPathCoverage($collected);
}

public function nameAndVersion(): string
Expand Down

0 comments on commit 1ae01b6

Please sign in to comment.