Repository navigation
Compact output - #6597
Closed
sebastianbergmann wants to merge 2 commits into
Closed
Compact output#6597sebastianbergmann wants to merge 2 commits into
sebastianbergmann wants to merge 2 commits into
Conversation
sebastianbergmann
force-pushed
the
feature/compact-output
branch
from
April 23, 2026 20:50
ca33271 to
7c04ae4
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6597 +/- ##
============================================
- Coverage 96.67% 96.27% -0.40%
- Complexity 8074 8161 +87
============================================
Files 839 840 +1
Lines 24928 25229 +301
============================================
+ Hits 24098 24289 +191
- Misses 830 940 +110 ☔ View full report in Codecov by Sentry. |
sebastianbergmann
force-pushed
the
feature/compact-output
branch
from
April 24, 2026 13:41
7c04ae4 to
2ceb15b
Compare
sebastianbergmann
added a commit
that referenced
this pull request
Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHPUnit's default output is designed for interactive use in a terminal: it shows progress as each test completes, reports timing and memory usage, and uses color to highlight the outcome. This is useful when you are watching tests run. But it is not always what you want.
When you run tests in a tight feedback loop, when you review test output in a CI log, or when you simply know what you are looking for, the ceremony gets in the way. The progress dots, the percentage counter, the timing line, the colour codes add nothing when all you need is "did it pass, and if not, what broke?"
You can already use
--no-progressto suppress the progress output. But that still leaves the timing and memory line, the colour codes, and the verbose result formatting with its numbered lists and prose headers. There is no combination of existing flags that gets you all the way to a clean, minimal output.--compactis a new output mode that strips PHPUnit's output down to what is actionable:No progress dots. No timing. No colour codes. When all tests pass, that is all you see.
When something fails, the output focuses on what you need to fix:
Each defect is a clearly delimited block with the test name, the assertion message, and the file location. Errors are listed before failures, followed by any other issues and in the order that typically matters when you are fixing things.
Like the default output,
--compactrespects the--display-*flags. By default, only errors, failures, and risky tests are shown. Use--display-deprecations,--display-warnings,--display-incomplete,--display-skipped, or--display-all-issuesto see more.AI-based coding assistants frequently run test suites as part of their workflow. Every token of test output that these tools consume costs context window budget. Progress dots and ANSI colour codes are particularly wasteful because they carry no information an AI agent can act on.
With
--compact, a passing test suite with 4699 tests produces 55 tokens instead of 1255: a 96% reduction. For failing suites, the savings are smaller (15-25%) because the failure details themselves are what matters, and both modes include them.Compact output can be activated with the
--compactCLI option or by setting thePHPUNIT_COMPACT_OUTPUT=1environment variable. The environment variable makes it easy to enable compact output globally for an AI assistant without changing how PHPUnit is invoked.