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

Detect slow PHPUnit tests with an extension delivered as a Composer package or PHAR. Configure a global maximum duration and get a report of tests exceeding the threshold after each run—ideal for catching performance regressions in your suite.

View on GitHub
Deep Wiki
Context7

⏱️ Provides a composer package with an extension for detecting slow tests in phpunit/phpunit.

Frequently asked questions about Phpunit Slow Test Detector
How do I install this package in my Laravel project?
Run `composer require --dev ergebnis/phpunit-slow-test-detector` to install the package. Then, add the extension to your `phpunit.xml` under the `<extensions>` tag and configure the `maximum-duration` parameter in milliseconds.
Does this work with Laravel’s default PHPUnit setup?
Yes, it integrates with Laravel’s default PHPUnit configuration in `phpunit.xml.dist`. Simply copy the extension and parameters to your custom `phpunit.xml` file, ensuring it overrides the default config.
What Laravel versions and PHPUnit versions are supported?
This package supports PHPUnit 6.5–13.x, which aligns with Laravel 5.8+ (PHPUnit 9.x+) and Laravel 9/10. It’s future-proof for Laravel 10+ with PHP 8.1+.
Can I configure different thresholds for CI vs. local development?
Yes, you can use environment-specific `phpunit.xml` files or override the `maximum-duration` parameter dynamically via command-line arguments or CI/CD variables.
Will this break existing Laravel test suites?
No, the package is non-intrusive and only adds slow-test detection logic. It won’t modify your test logic or assertions, but ensure your `phpunit.xml` properly includes the extension.
How do I integrate slow-test alerts into GitHub Actions?
Parse the CLI output in your workflow using `grep` or `awk` to filter slow-test messages, then trigger notifications via Slack, email, or other tools. Example: `phpunit | grep 'slow test' && curl -X POST -d @- SLACK_WEBHOOK`.
Is this compatible with PestPHP, or should I use Pest’s built-in timing features?
If you’re using PestPHP, this package is redundant since Pest has a native `--min-time` flag. Only use this if you rely on PHPUnit’s richer ecosystem or need advanced reporting.
How do I handle false positives in CI/CD pipelines?
Start with a conservative threshold (e.g., 1000ms) and adjust based on your test suite’s baseline. Monitor false positives in CI and refine thresholds or exclude specific tests using PHPUnit’s `@group` annotations.
Does this package add significant overhead to test runs?
No, the package adds minimal overhead—typically under 5% runtime impact. Benchmark your suite before and after installation to confirm performance isn’t degraded.
Can I use this in a Laravel project that uses custom PHPUnit extensions?
Yes, but ensure your custom extensions are compatible with PHPUnit 6.5+. If conflicts arise, test in a staging environment or consult the package’s GitHub issues for troubleshooting.
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
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
uri-template/tests