fix(tia): keep numeric file, branch and page names as strings (#2066)

Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
This commit is contained in:
Jhon Farias
2026-11-27 14:00:39 +01:00
committed by GitHub
parent 093ca57693
commit d314fc0540
14 changed files with 246 additions and 22 deletions
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
use Pest\Plugins\Tia\WatchPatterns;
it('matches a watch pattern whose key is a number', function (): void {
$watchPatterns = new WatchPatterns;
$watchPatterns->add(['123' => 'tests/Feature']);
expect($watchPatterns->matchedDirectories(sys_get_temp_dir(), ['123']))->toBe(['tests/Feature']);
});
it('selects the tests under a watch target whose name is a number', function (): void {
$watchPatterns = new WatchPatterns;
$watchPatterns->add(['config.txt' => '123']);
$directories = $watchPatterns->matchedDirectories(sys_get_temp_dir(), ['config.txt']);
expect($directories)->toBe(['123'])
->and($watchPatterns->testsUnderDirectories($directories, ['123/ConfigTest.php', 'tests/OtherTest.php']))
->toBe(['123/ConfigTest.php']);
});