- How do I install paraunit in a Laravel project?
- Run `composer require --dev facile-it/paraunit` in your project root. Paraunit integrates as a CLI tool via Composer’s bin directory, so no additional Laravel service provider or config is needed. Replace `phpunit` commands in your `composer.json` scripts with `paraunit run` for parallel execution.
- Does paraunit work with Laravel’s Pest framework?
- Yes, paraunit fully supports Pest. Replace Pest’s parallel execution with `paraunit run --group=unit` or `--group=feature` for granular control. Pest’s test groups and assertions remain unchanged, but execution speed improves significantly. Use `--stop-on-failure` in CI to mirror Pest’s default behavior.
- Will paraunit break my existing Laravel Dusk tests?
- No, paraunit is designed to work with Dusk out of the box. Use `paraunit run --display-warnings` to catch Selenium/ChromeDriver issues during parallel browser tests. The Symfony Process fallback ensures compatibility even without PCNTL, though performance may vary on Windows CI environments.
- What Laravel/PHPUnit versions does paraunit support?
- Paraunit 2.x supports PHPUnit 10.5.4+, 11+, 12+, and 13.0, and Symfony 4.4–8. It’s compatible with Laravel 8+ (PHP 7.4+) and Laravel 9/10 (PHP 8.0+). Check the [compatibility table](https://github.com/facile-it/paraunit#compatibility) for specific version pairings.
- How do I enable parallel coverage collection in Laravel?
- Run `paraunit coverage --html=./storage/logs/coverage` to generate HTML reports. Paraunit auto-detects the best coverage driver (PCov/Xdebug) and merges results in parallel. For CLI tools, use `--clover=./coverage.clover` to integrate with Laravel Forge or similar services.
- Can I use paraunit in GitHub Actions without PCNTL?
- Yes, paraunit falls back to Symfony’s Process component if PCNTL isn’t available. Performance may degrade slightly, but it remains functional. For Windows runners, reduce parallel processes with `--processes=2` to avoid resource contention. Test with `paraunit run --stop-on-failure` to fail fast in CI.
- Does paraunit support Laravel’s custom PHPUnit listeners?
- Yes, paraunit preserves all PHPUnit listeners and extensions. If you use custom listeners (e.g., for Laravel’s `RefreshDatabase` trait), they’ll work as expected. However, avoid `--stop-on-*` flags if listeners rely on test completion order, as parallel execution may alter execution sequences.
- How do I debug failing tests in parallel mode?
- Use `paraunit run --stop-on-failure` to halt execution on the first failure, similar to Laravel’s default behavior. For verbose output, add `--display-warnings` or `--display-deprecations`. If tests pass in serial but fail in parallel, check for race conditions with `--sort=random` to shuffle test order.
- What’s the best way to migrate from phpunit to paraunit in Laravel?
- Replace `phpunit` with `paraunit run` in your `composer.json` scripts. No changes to `phpunit.xml` are needed. For CI, update workflows to use `paraunit run --stop-on-failure --coverage`. Test incrementally by running a subset of tests first (e.g., `--filter=UserTest`).
- Are there alternatives to paraunit for Laravel?
- Yes, alternatives include PHPUnit’s built-in parallel mode (`phpunit --parallel`) or tools like `php-parallel-lint`. However, paraunit offers deeper PHPUnit integration (e.g., coverage merging, Symfony Process fallback) and better Laravel-specific features like Pest/Dusk support. Benchmark your project to compare speed and compatibility.