Add support for AI agent environment variables to quiet test output#21135
Add support for AI agent environment variables to quiet test output#21135Jarred-Sumner merged 9 commits intomainfrom
Conversation
This adds support for the CLAUDECODE environment variable to enable quiet test output, which reduces verbosity by only showing failures while still maintaining accurate test summary counts. When CLAUDECODE=1 is set: - Only test failures are displayed with their full output - Passing, skipped, and todo test indicators are hidden - Summary statistics are still shown at the end - JUnit reporter output remains unaffected When CLAUDECODE=0 or unset: - All test output is shown normally (existing behavior) This feature is useful for automated testing environments where reduced output verbosity improves readability while still providing essential failure information. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Updated 8:31 PM PT - Jul 17th, 2025
@Jarred-Sumner, your commit 25d749a is building: |
|
this probably should also force disable ansi (if it somehow gets enabled, as its a waste of its tokens) |
There was a problem hiding this comment.
it should just always run this code here then? not too good to duplicate the code
- Add filename suppression logic that only shows file paths when there's a failure - Remove duplicate JUnit reporting code for cleaner implementation - Track current file info in CommandLineReporter for deferred filename printing - Add printFilenameIfNeeded function to print filename only when needed - Maintain full JUnit reporting functionality in quiet mode This makes the quiet mode even more focused - showing only essential failure information while completely hiding successful test output. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
5c480c2 to
45af2b5
Compare
there they use
Jest : https://jestjs.io/docs/cli#--onlyfailures --onlyFailuresVitest --silent // to remove all outputs
--silent passed-only // let errors passthrough
I think we need those explicit flags so we have more control future wise after we have proper options for the test runner, |
This comment was marked as resolved.
This comment was marked as resolved.
Documents the AI agent integration feature that enables quieter test output for AI coding assistants. This feature was added in PR oven-sh#21135 and supports environment variables like CLAUDECODE=1, REPL_ID=1, and IS_CODE_AGENT=1 to minimize test output verbosity while preserving failure information. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
This PR adds support for AI agent environment variables to enable quiet test output in Bun's test runner. When an AI agent is detected through environment variables like
CLAUDECODE=1,REPL_ID=1, orIS_CODE_AGENT=1, the test runner reduces verbosity by only showing failures while still maintaining accurate test summary counts.Changes
Output.isAIAgent()function insrc/output.zigwhich detects:CLAUDECODE=1- Claude CodeREPL_ID=1- ReplitIS_CODE_AGENT=1- Generic AI agent flagsrc/cli/test_command.zig:writeTestStatusLine()- Skip non-failure status indicators in quiet modeprintTestLine()- Skip non-failure test line output (with full JUnit support)test/cli/test/claudecode-flag.test.tsBehavior
When AI agent is detected:
When no AI agent is detected:
Example Output
Normal mode (no AI agent):
Quiet mode (AI agent detected):
Test plan
This feature is useful for AI coding assistants where reduced output verbosity improves readability and context efficiency while still providing essential failure information.
🤖 Generated with Claude Code