Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Plugins/Tia.php
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,10 @@ private function enterRecordMode(array $arguments): array
return $arguments;
}

if (! $this->piggybackCoverage && ! in_array('--no-coverage', $arguments, true)) {
$arguments[] = '--no-coverage';
}

if (Parallel::isEnabled()) {
$this->purgeWorkerPartials();

Expand Down
38 changes: 38 additions & 0 deletions tests/Features/Tia/CoveragePiggyback.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,44 @@
->and($graph['files'])->toContain('app/Calculator.php');
})->skipOnWindows();

test('xml-configured coverage does not prevent tia recording', function (): void {
$project = Project::make('master');

$project->write('phpunit.xml', <<<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
colors="true"
failOnRisky="true"
failOnWarning="false"
>
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<clover outputFile="coverage/clover.xml" />
</report>
</coverage>
<source>
<include>
<directory suffix=".php">./app</directory>
</include>
</source>
</phpunit>
XML);

$result = $project->pest('--tia');

expect($result->exitCode)->toBe(0)
->and($project->graphExists())->toBeTrue()
->and(array_keys($project->graph()['edges']))->toEqualCanonicalizing(array_keys(Project::EDGES));
})->skipOnWindows();

test('a coverage report leaves the edges of an existing graph alone', function (): void {
$project = Project::make('master');
$project->seed('master');
Expand Down