Use Compact Test Output for Faster Feedback
When running tests in Claude Code, always use the --compact flag:
php artisan test --compact
This gives clean, single-line output per test:
..............................................
Tests: 46 passed (89 assertions)
Duration: 1.23s
Compare with the default verbose output which takes up far more context window space — and gives Claude a lot of noise to wade through when reading results.
For targeted testing, combine with --filter:
# Run a specific test file
php artisan test --compact tests/Feature/Voting/VoteTest.php
# Run tests matching a name pattern
php artisan test --compact --filter="user can upvote"
# Run a specific test directory
php artisan test --compact tests/Feature/Models/
Add this to your CLAUDE.md so Claude always uses it:
## Testing
- `php artisan test --compact` — run all tests
- `php artisan test --compact --filter=TestName` — run specific test
Compact output keeps Claude's context focused on what matters — failures, not noise.
Log in to leave a comment.
A PreToolUse hook can intercept test runner commands and filter output to show only failures, cutting thousands of tokens from Claude's context.
CLAUDE.md loads into every message. Move workflow-specific instructions into skills that load on demand to reduce token costs across your session.
Every event emitted while processing a single prompt shares a prompt.id UUID, letting you trace the complete chain of API calls and tool executions.