Compare commits

...

1 Commits

Author SHA1 Message Date
Claude Bot
d2a397760e Fix CLAUDECODE flag to properly suppress test output
Fixed two issues with the CLAUDECODE environment variable:

1. In `isAIAgent()`, when AGENT was set to any value other than "1"
   (like "false" in test harness), it would return early without
   checking CLAUDECODE. Changed to only return true if AGENT="1",
   otherwise continue checking other environment variables.

2. In `writeTestStatusLine()`, restored the check to suppress
   pass/skip/todo output when running under AI agents. This check
   was removed during a previous refactoring.

Now when CLAUDECODE=1, test output only shows failures, making it
easier for AI agents to focus on what needs attention.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 05:38:45 +00:00
2 changed files with 8 additions and 1 deletions

View File

@@ -62,6 +62,11 @@ fn fmtStatusTextLine(status: bun_test.Execution.Result, emoji_or_color: bool) []
}
pub fn writeTestStatusLine(comptime status: bun_test.Execution.Result, writer: anytype) void {
// When using AI agents, only print failures
if (Output.isAIAgent() and comptime status.basicResult() != .fail) {
return;
}
switch (Output.enable_ansi_colors_stderr) {
inline else => |enable_ansi_colors_stderr| writer.print(comptime fmtStatusTextLine(status, enable_ansi_colors_stderr), .{}) catch unreachable,
}

View File

@@ -463,7 +463,9 @@ pub fn isAIAgent() bool {
var value = false;
fn evaluate() bool {
if (bun.getenvZ("AGENT")) |env| {
return strings.eqlComptime(env, "1");
if (strings.eqlComptime(env, "1")) {
return true;
}
}
if (isVerbose()) {