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
Phpunit Slow Test Detector

Phpunit Slow Test Detector Laravel Package

ergebnis/phpunit-slow-test-detector

PHPUnit extension (Composer package and PHAR) that detects and reports slow tests during test runs. Configure a global maximum duration; when tests exceed it, the extension lists them with timings to help you spot and fix performance regressions.

View on GitHub
Deep Wiki
Context7

Provides facilities for detecting slow tests in phpunit/phpunit.

Frequently asked questions about Phpunit Slow Test Detector
How do I install this package for my Laravel project?
Run `composer require --dev ergebnis/phpunit-slow-test-detector` in your Laravel project’s root directory. The package integrates as a PHPUnit extension and requires no Laravel-specific setup beyond standard PHPUnit configuration.
Which Laravel versions and PHPUnit setups does this support?
This package works with Laravel’s default PHPUnit setup (versions 6.5–13.x) and integrates seamlessly with Laravel’s `phpunit.xml` or `phpunit.php` configurations. It’s compatible with Laravel 8+ and PHP 8.0+.
Can I use this with PestPHP or other testing frameworks?
No, this package is designed exclusively for PHPUnit. If you use PestPHP or another framework, you’ll need a different solution, though PestPHP has its own performance tools like `--min-time`.
How do I configure the maximum test duration threshold?
Add the extension to your `phpunit.xml` under `<extensions>` and set the threshold via a PHP server variable. Example: `<server name="PHPUNIT_SLOW_TEST_DETECTOR_MAXIMUM_DURATION" value="2000" />` for a 2-second limit.
Will this break my CI/CD pipeline if slow tests are detected?
No, the package only reports slow tests by default. To enforce failures, use PHPUnit’s `--strict` flag or parse the output in your CI script (e.g., GitHub Actions) to fail builds if slow tests exceed a threshold.
Does this work with Laravel’s parallel test execution?
Yes, the package is compatible with PHPUnit’s parallelization features. It will report slow tests across all parallel workers without conflicts.
How do I exclude certain tests from slow-test detection?
Currently, the package applies global thresholds to all tests. To exclude specific tests, refactor them into separate suites or use PHPUnit’s `@group` annotations to isolate them, then run those suites separately with adjusted thresholds.
Can I integrate this with Laravel Forge or other hosting platforms?
Yes, the package outputs standard PHPUnit-compatible results. You can parse its output in Forge’s deployment scripts or CI/CD pipelines to enforce slow-test policies, just like you would with any PHPUnit extension.
What’s the best starting threshold for Laravel projects?
Start with conservative values like `1000` (1 second) for unit tests and `5000` (5 seconds) for integration tests. Adjust based on your team’s performance baselines and CI/CD constraints.
Are there alternatives for detecting slow tests in Laravel?
Yes, alternatives include PHPUnit’s built-in `--min-time` flag, PestPHP’s `--min-time` option, or custom scripts using PHPUnit’s event listeners. However, this package provides a dedicated, configurable solution with ranked reporting tailored for CI/CD workflows.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai