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

Paratest Laravel Package

brianium/paratest

ParaTest runs PHPUnit tests in parallel with near zero setup. Use vendor/bin/paratest to split by TestCase or individual tests, speed up CI, and combine code coverage into one report. Provides TEST_TOKEN/UNIQUE_TEST_TOKEN for per-process isolation.

View on GitHub
Deep Wiki
Context7

ParaTest brings fast, parallel execution to PHPUnit with minimal friction. Install it and run vendor/bin/paratest to split your suite across multiple processes—either by TestCase or, with --functional, by individual tests—without extra bootstrap or configuration.

Designed for modern PHPUnit, ParaTest also helps keep reporting consistent when running in parallel.

  • Zero configuration parallelization via vendor/bin/paratest
  • Run in parallel by TestCase or by test (--functional)
  • Built-in TEST_TOKEN / UNIQUE_TEST_TOKEN env vars for per-process isolation (e.g., databases)
  • Combined code coverage output merged into a single report
  • Simple CLI with comprehensive --help options
Frequently asked questions about Paratest
Can I use brianium/paratest with Laravel’s default PHPUnit 10/11 without upgrading?
No, ParaTest requires PHPUnit 13+ due to its reliance on internal APIs. If upgrading isn’t feasible, you’d need to fork ParaTest to support older versions, but this adds maintenance overhead. Check your Laravel version’s PHPUnit compatibility first.
How do I handle Laravel’s RefreshDatabase trait with parallel tests?
ParaTest’s TEST_TOKEN environment variable lets you assign unique database names per process (e.g., `testdb_$TEST_TOKEN`). This avoids conflicts with Laravel’s transaction rollbacks. Disable transactions entirely if needed, but TEST_TOKEN isolation is the recommended approach.
Will ParaTest break tests that use static state or App::singleton()?
Yes, static state or Laravel’s service container singletons can cause race conditions. Refactor tests to use dependency injection or move shared logic to non-test classes. ParaTest’s UNIQUE_TEST_TOKEN can help isolate some cases, but static variables are inherently unsafe.
How do I configure ParaTest for GitHub Actions CI with Laravel?
Replace `phpunit` with `paratest` in your workflow. Use `--coverage` for combined coverage reports and limit initial processes with `--max-processes=4` to validate stability. Example: `vendor/bin/paratest --coverage --max-processes=4 tests/Unit`.
Does ParaTest support Laravel’s MigrateFresh or other test database helpers?
Yes, but ensure your test classes use TEST_TOKEN for database names (e.g., `testdb_$TEST_TOKEN`). MigrateFresh will run per process, but you may need to adjust migrations to handle parallel schema changes or use `--parallel` cautiously.
How do I debug failing tests in parallel mode?
Use `paratest_for_phpstorm` for IDE debugging or run with `--verbose` to see process IDs. Check for race conditions in tests using shared resources (e.g., files, static caches). ParaTest’s output includes sharding details to identify problematic test groups.
What’s the best way to test flaky tests in parallel?
Start with `--max-processes=2` to isolate flakes, then gradually increase. Use `UNIQUE_TEST_TOKEN` to log process-specific data (e.g., timestamps) and compare runs. If flakes persist, revert to sequential tests or refactor the test to avoid shared dependencies.
Can I use ParaTest with Laravel’s Pest testing framework?
No, ParaTest is designed for PHPUnit only. Pest uses a different test runner and doesn’t integrate with ParaTest’s parallelization logic. Stick to PHPUnit for parallel testing in Laravel.
How does ParaTest handle code coverage for Laravel’s PCOV setup?
ParaTest combines coverage from all processes into a single report when using `--coverage`. Ensure your `phpunit.xml` includes `<coverage>` config and that PCOV is installed. For xDebug, use `--coverage-xdebug` instead. CI pipelines may need adjusted coverage thresholds.
What’s the fallback if ParaTest introduces instability in production?
Revert to sequential tests by removing ParaTest from `composer.json` and running `phpunit` directly. Cache test results (e.g., with `--cache-result`) to avoid reprocessing. Monitor CI runs closely after migration to catch regressions early.
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
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
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