diff --git a/bin/pest b/bin/pest index a6f87492..ef9b1a84 100755 --- a/bin/pest +++ b/bin/pest @@ -121,7 +121,7 @@ use Symfony\Component\Console\Output\ConsoleOutput; } } - if (str_contains($value, '--teamcity')) { + if ($value === '--teamcity') { unset($arguments[$key]); $arguments[] = '--no-output'; unset($_SERVER['COLLISION_PRINTER']); diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index b7d75383..3c496883 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -2503,6 +2503,8 @@ WARN Tests\Visual\TeamCity - visual snapshot of team city with ('Failure.php') - visual snapshot of team city with ('SuccessOnly.php') + ✓ preserves TeamCity text in a test filter with dataset "attached value" + ✓ preserves TeamCity text in a test filter with dataset "separate value" WARN Tests\Visual\Todo - todos @@ -2521,4 +2523,4 @@ ✓ pass with dataset with ('my-datas-set-value') ✓ within describe → pass with dataset with ('my-datas-set-value') - Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 38 skipped, 1829 passed (4146 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 38 skipped, 1831 passed (4150 assertions) \ No newline at end of file diff --git a/tests/Visual/TeamCity.php b/tests/Visual/TeamCity.php index 83d6ec21..8a716e6a 100644 --- a/tests/Visual/TeamCity.php +++ b/tests/Visual/TeamCity.php @@ -46,3 +46,17 @@ test('visual snapshot of team city', function (string $testFile): void { 'Failure.php', 'SuccessOnly.php', ])->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE')); + +test('preserves TeamCity text in a test filter', function (array $filterArguments): void { + $process = new Process( + [PHP_BINARY, 'bin/pest', '--colors=never', 'tests/Fixtures/Suites/SuccessOnly.php', ...$filterArguments], + dirname(__DIR__, 2), + ['PARATEST' => '0', 'PAO_DISABLE' => '1'], + ); + + expect($process->run())->toBe(0) + ->and($process->getOutput())->toContain('1 passed (1 assertions)'); +})->with([ + 'attached value' => [['--filter=can pass with comparison|--teamcity']], + 'separate value' => [['--filter', 'can pass with comparison|--teamcity']], +]);