Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pest Plugin Parallel Laravel Package

pestphp/pest-plugin-parallel

Official parallel testing plugin for Pest. Run your test suite concurrently across CPU cores to speed up feedback, with simple configuration and CLI options. Ideal for large projects and CI pipelines looking to reduce test runtime.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the plugin via Composer: composer require pestphp/pest-plugin-parallel --dev. Run your tests with pest --parallel—no configuration required. By default, it spawns one process per CPU core and splits test files evenly. Your first real-world use case: running a 5-minute Laravel feature test suite down to ~1.5 minutes in CI, especially for I/O-heavy or database-bound tests. Just run php artisan test --parallel (Laravel) or pest --parallel (plain Pest) in your terminal.

Implementation Patterns

  • Granular control: Use --steps=N to specify how many batches to split tests into (e.g., --steps=3 for 3 runners), helpful when test files vary widely in runtime.
  • Laravel integration: Leverage php artisan test --parallel—Laravel automatically handles DB connection isolation (each process gets a unique DB_CONNECTION suffix like testing-1, testing-2) and environment cleanup.
  • Event-driven customization: In Laravel, listen to Pest\Parallel\Events\JobStarted or JobFinished to add logging, metrics, or bootstrap logic (e.g., seeding per-process test databases).
  • Local debugging: Set PARALLEL_TESTS=1 as an environment variable to force single-process execution while keeping other --parallel flags intact.

Gotchas and Tips

  • Flaky test diagnosis: Failures only sometimes reproduce in parallel often indicate shared state. Add --stop-on-failure to catch the first issue, then re-run that single test file with pest path/to/file_test.php to debug.
  • Database isolation: --parallel doesn’t auto-isolate DB state—ensure you’re using Laravel’s RefreshDatabase (not DatabaseTransactions) or manually set DB_CONNECTION=testing-{$processId}.
  • Coverage pitfalls: Coverage tools like Xdebug/XHProf may interfere with parallelism or produce corrupted reports. Prefer pcov (e.g., pest --parallel --coverage --coverage-driver=pcov) or avoid coverage in CI parallel runs.
  • Global state red flags: Any use of putenv(), static properties, or file-based caches (e.g., without unique per-process paths like /tmp/pest-$$-cache) will cause race conditions. Always scope globals to $_SERVER, process-specific temp directories, or use dependency injection.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation