mrpunyapal / pest-annotator-plugin
A Pest plugin that annotates uncovered classes and methods with clean, colorized output when running pest --coverage.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/mrpunyapal/pest-annotator-plugin
Requires
- php: ^8.3
- pestphp/pest-plugin: ^4.0
Requires (Dev)
- laravel/pint: ^1.14
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- phpstan/phpstan: ^2.0
- rector/rector: ^2.0
README
A Pest PHP plugin that automatically annotates uncovered classes and methods with clean, colorized output when running pest --coverage.
Requirements
- PHP 8.3+
- Pest PHP 4.0+
- A code coverage driver (Xdebug, PCOV, or PHPDBG)
Installation
composer require --dev mrpunyapal/pest-annotator-plugin
Usage
Just run Pest with coverage enabled — the plugin activates automatically:
./vendor/bin/pest --coverage
Example Output
After Pest's default per-file coverage table, the plugin appends class-level annotations:
━━━ Fully Uncovered Classes ━━━
📄 Class: App\Services\InvoiceService
Coverage: 0%
❌ Uncovered: cancel(), refund(), generateInvoice()
━━━ Partially Covered Classes ━━━
📄 Class: App\Services\PaymentService
Coverage: 66.7%
❌ Uncovered: refund()
✅ Covered: charge(), validate()
━━━ Summary ━━━
Total Classes: 5
Fully Covered: 3
Partially Covered: 1
Fully Uncovered: 1
How It Works
- Hooks into Pest's plugin lifecycle via
HandlesArgumentsandAddsOutput - Detects
--coverageflag — no extra flags needed - After tests complete, reads the native
CodeCoverageobject (before Pest's own coverage plugin processes it) - Extracts class-level and method-level coverage data from
SebastianBergmann\CodeCoverage - Renders annotated output grouped by coverage status (uncovered → partial → summary)
Development
git clone https://github.com/mrpunyapal/pest-annotator-plugin.git cd pest-annotator-plugin composer install composer test
License
MIT