pestphp / pestphp/pest

[Bug]: `ArchTest.php` not running on Windows

Open
#1,312 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
11.7k
Forks
538
Avg merge
4d 11h
Merged PRs (30d)
8

Description

What Happened

I have copied the test structure from Pinkary, with an Arch folder and an ArchTest.php file in the root. I have added a new testsuite to phpunit.xml with the folder and file. The file is not included when running pest --arch, until I add it to the testsuite with a backslash.

<testsuite name="Arch">
    <directory>tests/Arch</directory>
    <file>tests/ArchTest.php</file>
    <file>tests\ArchTest.php</file><!-- If I add this it automatically runs on Windows -->
</testsuite>

I believe this to be a Windows issue because of the backward slash. Also, it's possible that it is a PHPUnit issue, but I thought that I'd open it here first and get some feedback.

How to Reproduce
  • Install Pinkary project on Windows machine
  • Run pest --arch and see that ArchTest.php is not included
  • Add <file>tests\ArchTest.php</file> with backslash to testsuite in phpunit.xml
  • Run pest --arch again and see that the file is included
Sample Repository

https://github.com/pinkary-project/pinkary.com

Pest Version

3.5.1

PHP Version

8.3.13

Operation System

Windows

Notes

Running without backslash:

❯ pest --arch

   PASS  Tests\Arch\LivewireTest
  ✓ livewire components                                                                                                                                                                                        0.13s  

  Tests:    1 passed (2 assertions)
  Duration: 0.28s

Running with backslash:

❯ pest --arch

   PASS  Tests\Arch\LivewireTest
  ✓ livewire components                                                                                                                                                                                        0.39s  

   PASS  Tests\ArchTest
  ✓ preset → php                                                                                                                                                                                               0.28s  
  ✓ preset → security                                                                                                                                                                                          0.01s  
  ✓ preset → laravel → ignoring 'App\Providers\Filament'                                                                                                                                                       0.12s  

  Tests:    4 passed (43 assertions)
  Duration: 1.08s

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the testsuite entries in phpunit.xml and reproduce the issue using pest --arch on Windows with the paths shown. Trace how ArchTest.php is discovered when the path uses forward versus backslashes; done means the file runs without requiring the extra backslash entry.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.