From b0c2a07190b94be9ff0b3af1d970a0224dc0ce3b Mon Sep 17 00:00:00 2001 From: Shang Chieh Tseng Date: Wed, 17 Dec 2025 16:08:01 +0800 Subject: [PATCH] Fix JSON output contamination in test runner Change judge.ts progress message from console.log (stdout) to process.stderr.write (stderr) to prevent 'Judging batch...' message from contaminating JSON output when using --output json flag. --- tests/src/judge.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/src/judge.ts b/tests/src/judge.ts index 8d26ded8..8aafc559 100644 --- a/tests/src/judge.ts +++ b/tests/src/judge.ts @@ -98,8 +98,9 @@ Respond ONLY with the JSON array, no other text.`; // Process in batches for (let i = 0; i < results.length; i += this.batchSize) { const batch = results.slice(i, i + this.batchSize); - console.log( - ` Judging batch ${Math.floor(i / this.batchSize) + 1}/${Math.ceil(results.length / this.batchSize)}...`, + // Write progress to stderr to avoid contaminating JSON output on stdout + process.stderr.write( + ` Judging batch ${Math.floor(i / this.batchSize) + 1}/${Math.ceil(results.length / this.batchSize)}...\n`, ); try {