pestphp / pestphp/pest

Pest v4 does not terminate when executed inside a Deployer `runLocally` task

Open
#1,486 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Pest v4 does not terminate when executed inside a Deployer runLocally task

Description

When running Pest v4 inside a Deployer runLocally task, the command never terminates and the task hangs indefinitely.
With Pest v3, the same setup works as expected.


Steps to Reproduce
  1. Create a Deployer task:

    // Runs architecture tests
    task(
        'test:architecture',
        function () {
            $output = runLocally('composer test-architecture');
            writeln('<info>'.$output.'</info>');
        }
    )->desc('Run architectural tests');
    
  2. Add the following script to your composer.json:

    "scripts": {
        "test-architecture": "XDEBUG_MODE=off ./vendor/bin/pest --parallel --bail --group=architectural --colors=always"
    }
    
  3. Run the task via Deployer:

    dep test:architecture -vvv
    

Expected Behavior (Pest v3)

The task completes successfully:

Image
Actual Behavior (Pest v4)

The task does not terminate.
The test results are printed, but runLocally never finishes, so the deployment process hangs:

Image
Environment
  • Laravel: 12.x
  • Pest version: 4.0.4
  • Deployer version: 7.x
  • PHP version: 8.4.x
  • OS: macOS Sonoma

Notes
  • Works correctly with Pest v3.
  • The issue only occurs when running via Deployer’s runLocally; running composer test-architecture manually in the shell works fine.
  • Appears related to process handling / termination in Pest v4.

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 by reproducing the hang with the Deployer runLocally task and the composer test-architecture script, then compare execution under Pest v3 and v4. Focus on Pest v4's parallel process handling and termination behavior; done means the Deployer task exits after printing results, while manual composer execution remains functional.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.