Files
pest/tests/Features/Tia/Locally.php
T
Tiago Santos 8eb2892f69 fix(tia): skip locally() when the process is on CI (#1999)
* fix(tia): skip locally() when the process is on CI

locally() only looked at --ci, so a CI job that followed the docs and
ran plain pest replayed cached results.

Fixes #1970

* test(tia): clear CI variables so the local assertion passes on CI

* test: update snapshots for TIA CI detection

---------

Co-authored-by: Tiago Santos <tsantos@lynixt.pt>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-02 17:26:12 +05:30

29 lines
942 B
PHP

<?php
declare(strict_types=1);
use Tests\Fixtures\Tia\Project;
afterEach(function (): void {
Project::destroyAll();
});
test('locally configured tia does not replay when the process is on CI', function (): void {
$project = Project::make('master');
$pestFile = $project->path('tests/Pest.php');
file_put_contents($pestFile, file_get_contents($pestFile)."\npest()->tia()->locally();\n");
$project->seed('master');
$onCi = $project->pestWithEnvironment($project->path(), ['CI' => 'true']);
expect($onCi->exitCode)->toBe(0, $onCi->describe())
->and($onCi->output)->not->toContain('TIA mode')
->and($onCi->replayed())->toBe(0)
->and($onCi->tally())->toContain(Project::TOTAL_TESTS.' passed');
$local = $project->pest();
expect($local->exitCode)->toBe(0, $local->describe())
->and($local->replayed())->toBe(Project::TOTAL_TESTS, $local->describe());
})->skipOnWindows();