pestphp / pestphp/pest

[Bug]: --parallel causes "Undefined array key 'testdox-columns'" warning in worker.php

Open Beginner friendly
#1,573 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

When running tests with the --parallel flag, Pest v4.1.3 throws an "Undefined array key" warning for testdox-columns in the worker process, causing the test run to fail with a WorkerCrashedException.

How to Reproduce
  1. Install Pest v4.1.3 in a Laravel 12 project
  2. Run tests with parallel execution:
    php artisan test --parallel

Expected Behavior:

Tests should run in parallel without warnings or errors, similar to sequential execution.

Actual Behavior:

The test run fails with the following error:

  In WorkerCrashedException.php line 41:

    The test "PARATEST='1' TEST_TOKEN='10' UNIQUE_TEST_TOKEN='10_691e399881a5a'
  /path/to/tests/Feature/StaticCampaignTest.php" failed.

    Exit Code: 1(General error)

    Output:
    ================

       INFO  Warning: Undefined array key "testdox-columns" in
  /path/to/vendor/pestphp/pest/bin/worker.php on line 89.

  Root Cause:

  In vendor/pestphp/pest/bin/worker.php at line 89, the code attempts to access
  $getopt['testdox-columns'] without first checking if the key exists:

  $application = new ApplicationForWrapperWorker(
      $phpunitArgv,
      $getopt['progress-file'],
      $getopt['unexpected-output-file'],
      $getopt['test-result-file'],
      $getopt['result-cache-file'] ?? null,
      $getopt['teamcity-file'] ?? null,
      $getopt['testdox-file'] ?? null,
      isset($getopt['testdox-color']),
      (int) $getopt['testdox-columns'] ?? null,  // ❌ Line 89 - Bug here
  );

The issue is that the code tries to cast to (int) before the null coalescing operator checks if the key exists. When running in parallel mode, the testdox-columns option is not always passed to worker processes, causing PHP to emit an "Undefined array key" warning.

Sample Repository

No response

Pest Version

4.1.3

PHP Version

8.3.26

Operation System

macOS

Notes

No response

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 vendor/pestphp/pest/bin/worker.php around line 89 and reproduce the warning using php artisan test --parallel in a Laravel 12 project. Verify the worker handles a missing testdox-columns option without warnings or a WorkerCrashedException, while parallel tests continue to run successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
cli, testing
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.