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.61k stars 358 forks source link

[Bug]: Using `--mutate --parallel --processes=X` ignores num processes #1228

Closed rabrowne85 closed 1 month ago

rabrowne85 commented 1 month ago

What Happened

When you run Pest 3 with the following options:

./vendor/bin/pest --mutate --parallel --processes=x

it should limit the processes to the value specified. However, it ignores the option entirely.

How to Reproduce

Running the above command.

Sample Repository

No response

Pest Version

3.0.1

PHP Version

8.3.10

Operation System

macOS

Notes

Looking at the source for the plugin, the ProcessesOption@match() function seems to be a bit greedy. Locally adjusting the function to the following seems to resolve the issue:

    public static function match(string $argument): bool
    {
        return $argument === str_starts_with($argument, sprintf('--%s=', self::ARGUMENT));
    }
gehrisandro commented 1 month ago

Thanks, @rabrowne85, for reporting the issue.

Fixed here https://github.com/pestphp/pest-plugin-mutate/pull/14