Skip to content
Merged
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 @@ -1238,6 +1238,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
39 changes: 39 additions & 0 deletions tests/Features/Tia/CoveragePiggyback.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

declare(strict_types=1);

use Pest\Support\Coverage;
use Tests\Fixtures\Tia\Project;

afterEach(function (): void {
Expand Down Expand Up @@ -39,6 +40,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_WRAP'
<?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_WRAP);

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

expect($result->exitCode)->toBe(0, $result->describe())
->and($project->graphExists())->toBeTrue()
->and(array_keys($project->graph()['edges']))->toEqualCanonicalizing(array_keys(Project::EDGES));
})->skipOnWindows()->skip(! Coverage::isAvailable(), 'Coverage is not available');

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