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>
This commit is contained in:
Tiago Santos
2026-11-02 11:56:12 +00:00
committed by GitHub
parent e7a1b483f0
commit 8eb2892f69
6 changed files with 96 additions and 5 deletions
+6 -2
View File
@@ -33,6 +33,7 @@ use Pest\Plugins\Tia\SourceScope;
use Pest\Plugins\Tia\Storage;
use Pest\Plugins\Tia\TableExtractor;
use Pest\Plugins\Tia\WatchPatterns;
use Pest\Support\Ci;
use Pest\Support\Container;
use Pest\Support\Git;
use Pest\Support\View;
@@ -334,7 +335,7 @@ final class Tia implements AddsOutput, HandlesArguments, HandlesOriginalArgument
return true;
}
return ! self::argumentPresent('--ci', $arguments);
return ! Ci::isRunning() && ! self::argumentPresent('--ci', $arguments);
}
/**
@@ -482,8 +483,11 @@ final class Tia implements AddsOutput, HandlesArguments, HandlesOriginalArgument
self::applyWatchPatternMarks($arguments, $watchPatterns);
$disabled = $this->hasArgument(self::NO_OPTION, $arguments);
$cliEnabled = $this->hasArgument(self::OPTION, $arguments) || self::envFlagEnabled(self::ENV_TIA);
$runningOnCi = Ci::isRunning()
|| $this->hasArgument('--ci', $arguments)
|| $this->hasArgument('--ci', $this->originalArguments);
$alwaysEnabled = $watchPatterns->isEnabled()
&& (! $watchPatterns->isLocally() || Environment::name() === Environment::LOCAL);
&& (! $watchPatterns->isLocally() || ! $runningOnCi);
if (! $isWorker && ! $disabled && ($cliEnabled || $alwaysEnabled)) {
$this->guardUnsupportedOptions($arguments);
}
+1 -1
View File
@@ -14,7 +14,7 @@ final class Ci
/**
* @var list<string>
*/
private const array ENVIRONMENT_VARIABLES = [
public const array ENVIRONMENT_VARIABLES = [
'CI',
'GITHUB_ACTIONS',
'GITLAB_CI',