Use Compact Test Output to Preserve Your Context Window
Verbose test output bloats your context window with hundreds of passing-test lines before Claude even gets to see the failures. Using compact or quiet output flags keeps things lean and fast.
Pest (Laravel):
php artisan test --compact
pytest:
python -m pytest -q
python -m pytest --tb=short # shorter tracebacks on failures
Jest / Vitest:
npm test -- --silent
npx vitest run --reporter=dot
RSpec:
bundle exec rspec --format progress
For targeted testing, combine with filter flags to focus Claude on the problem area:
# Laravel/Pest
php artisan test --compact --filter="user can vote"
# pytest
python -m pytest -q -k "test_user_can_vote"
# Jest
npm test -- --silent --testNamePattern="user can vote"
Document the flags in your CLAUDE.md so Claude always reaches for compact output automatically:
## Testing
- `php artisan test --compact` — run all tests
- `npm test -- --silent` — run Jest tests
- `python -m pytest -q` — run pytest
Compact output keeps Claude's context focused on what matters — failures, not noise.
Log in to leave a comment.
When Claude starts referencing files you've since deleted, remembering old code you've already changed, or getting confused by contradictory instructions from a long session — type /clear to wipe the slate clean. Unlike /compact which preserves context, /clear gives you a true fresh start without restarting the CLI.
Not every task needs deep reasoning. Type /fast to switch Claude Code into fast mode — same model, faster output — for quick edits, simple questions, and routine changes. Toggle it off when you need Claude to think harder on complex problems.
Long sessions eat through your context window as conversation history piles up. Type /compact to summarize the conversation so far and reclaim space — keeping Claude's understanding of what you're working on while freeing up room for more work.