pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.07k stars 315 forks source link

[Bug]: Running tests in parallel doesn't write testdox result files #1065

Open raf-lv opened 5 months ago

raf-lv commented 5 months ago

What Happened

When I run pest with the --parallel flag (and with testdox configured in my phpunit.xml) I'm not getting any testdox result files written to storage/tests/ (as per configured).

If I remove --parallel then I do.

Here's my phpunit.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php"
    colors="true" processIsolation="false" stopOnFailure="false" testdox="true"
    xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache"
    backupStaticProperties="false">
    <coverage>
        <report>
            <html lowUpperBound="40" highLowerBound="75" outputDirectory="./storage/tests/coverage"/>
        </report>
    </coverage>
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory suffix="Test.php">./tests/Feature</directory>
        </testsuite>
    </testsuites>
    <php>
        <server name="APP_ENV" value="testing"/>
        <server name="BCRYPT_ROUNDS" value="4"/>
    </php>
    <source>
        <include>
            <directory suffix=".php">./app</directory>
        </include>
    </source>
    <logging>
        <testdoxText outputFile="storage/tests/testdox.txt"/>
        <testdoxHtml outputFile="storage/tests/testdox.html"/>
    </logging>
</phpunit>

How to Reproduce

Install a fresh Laravel app, add Pest, add the phpunit.xml mentioned earlier, add some dummy tests.

run ./vendor/bin/pest --parallel and node that the testdox result file is not created: storage/tests/testdox.txt

run the same command but without --parallel, the file storage/tests/testdox.txt is then created as expected.

Sample Repository

No response

Pest Version

2.28.0

PHP Version

8.2.14

Operation System

Linux

Notes

No response