Add support for AI agent environment variables to quiet test output#21135
Merged
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 <[email protected]>
Collaborator
Author
|
Updated 8:31 PM PT - Jul 17th, 2025
@Jarred-Sumner, your commit 25d749a is building: |
Contributor
|
this probably should also force disable ansi (if it somehow gets enabled, as its a waste of its tokens) |
RiskyMH
reviewed
Jul 17, 2025
Comment on lines
652
to
656
Contributor
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 <[email protected]>
robobun
force-pushed
the
claude/add-claudecode-flag
branch
from
July 17, 2025 15:42
5c480c2 to
45af2b5
Compare
Contributor
there they use
--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.
robobun
pushed a commit
to robobun/bun
that referenced
this pull request
Jul 18, 2025
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 <[email protected]>
3 tasks
4 tasks
This was referenced Mar 2, 2026
Closed
6 tasks
Draft
3 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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