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 Pretty Print Laravel Package

sempro/phpunit-pretty-print

Pretty-print PHPUnit test output for cleaner, more readable console runs. sempro/phpunit-pretty-print adds a nicer, compact format that highlights failures and progress, helping you scan results faster while keeping compatibility with standard PHPUnit workflows.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer:

composer require --dev sempro/phpunit-pretty-print

No configuration is required to start—just run your tests as usual (phpunit). The package automatically hooks into PHPUnit’s output formatting. For projects with custom bootstrap or configuration, ensure phpunit.xml doesn’t override the default output printer (if using printerFile, skip this—just load via Composer’s autoloader as normal).

Your first use case: run a small test suite locally to see immediately improved readability—e.g., colored pass/fail indicators, grouped failures, and compact stack traces.

Implementation Patterns

  • Zero-config integration: Drop in via --dev require and run ./vendor/bin/phpunit. The package registers itself as the default output printer (via PHPUnit\Runner\Version::getVersion() detection and composer's extra.phpunit auto-discovery).
  • CI-ready output: Works transparently with GitHub Actions, GitLab CI, or Jenkins. Set phpunit.xml’s colors to never in CI (or use --no-coverage if needed) to preserve structured clarity without ANSI codes.
  • Custom reporter fallback: If you already use a custom printer (e.g., junit or testdox), this package does not interfere—it only enhances the default text and progress formatters. For full control, explicitly declare the printer class:
    <phpunit printerClass="Sempro\PHPUnit\PrettyPrinter\Printer">
    
  • Composable with debugging tools: Pair with phpspec/prophecy or brianium/paratest—output remains readable even when parallelizing.

Gotchas and Tips

  • Disabling coloring in non-TTY environments: In headless CI, some platforms render ANSI codes oddly. Use phpunit --no-ansi or set <php><env name="TERM" value="dumb"/></php> in phpunit.xml.
  • Version compatibility: Last release was in 2021. Confirm compatibility with your PHPUnit version (works well with PHPUnit 8–9; may not support PHPUnit 10+ without updates—check fork activity or vendor lock-in before adopting in large projects).
  • Stack trace trimming: The package trims common boilerplate (e.g., /vendor/ paths), but excessive nesting may still clutter output. Add custom trace filters in phpunit.xml if needed.
  • Extensibility: Though not documented, extending the Printer class is possible. Override methods like printResult() for team-specific formatting (e.g., adding time deltas or emoji prefixes).
  • CI log noise: If using log output (--log-junit), the pretty-printer only affects console output—JUnit/XML logs remain untouched. Use this to keep logs machine-readable while improving human-facing console feedback.
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