From 213621cedaab1a5f51cb8ea55d78a3faf66b6246 Mon Sep 17 00:00:00 2001 From: Benjamin Liu Date: Wed, 3 Jun 2026 16:37:06 +0900 Subject: [PATCH 1/2] fix(test): bump runCli maxBuffer to fit growing manifest opencli list -f json crossed 1 MB at 1030 entries on v1.8.2 so the execFile default overflows and the helper returns code ERR_CHILD_PROCESS_STDIO_MAXBUFFER instead of the real exit code. Closes #1841 --- tests/e2e/helpers.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/e2e/helpers.ts b/tests/e2e/helpers.ts index 2b75b30d1..a83b3692a 100644 --- a/tests/e2e/helpers.ts +++ b/tests/e2e/helpers.ts @@ -25,14 +25,20 @@ export interface CliResult { */ export async function runCli( args: string[], - opts: { timeout?: number; env?: Record } = {}, + opts: { timeout?: number; env?: Record; maxBuffer?: number } = {}, ): Promise { const timeout = opts.timeout ?? 30_000; + // `opencli list -f json` already weighs ~1 MB at 1030 entries on v1.8.2 and + // grows with every new adapter. The execFile default maxBuffer is 1 MB; past + // it stdout overflows and the helper returns code + // 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER' instead of the actual exit code. + const maxBuffer = opts.maxBuffer ?? 16 * 1024 * 1024; try { const runtime = process.env.OPENCLI_TEST_RUNTIME || 'node'; const { stdout, stderr } = await exec(runtime, [MAIN, ...args], { cwd: ROOT, timeout, + maxBuffer, env: { ...process.env, // Prevent chalk colors from polluting test assertions From fec65534d4457df97e14e0fd424cace216510bc5 Mon Sep 17 00:00:00 2001 From: Benjamin Liu Date: Wed, 3 Jun 2026 19:57:07 +0900 Subject: [PATCH 2/2] refactor(test): extract DEFAULT_MAX_BUFFER_BYTES constant Pulls the runCli stdout cap out of the function body so future tuning lands in one place. --- tests/e2e/helpers.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/e2e/helpers.ts b/tests/e2e/helpers.ts index a83b3692a..4883ef551 100644 --- a/tests/e2e/helpers.ts +++ b/tests/e2e/helpers.ts @@ -13,6 +13,15 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); const ROOT = path.resolve(__dirname, '../..'); const MAIN = path.join(ROOT, 'dist', 'src', 'main.js'); +/** + * Default stdout cap for `runCli`. `opencli list -f json` already weighs + * ~1 MB at 1030 entries on v1.8.2 and grows with every new adapter. The + * execFile default maxBuffer is 1 MB; past it stdout overflows and the + * helper returns code 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER' instead of the + * actual exit code. + */ +const DEFAULT_MAX_BUFFER_BYTES = 16 * 1024 * 1024; + export interface CliResult { stdout: string; stderr: string; @@ -28,11 +37,7 @@ export async function runCli( opts: { timeout?: number; env?: Record; maxBuffer?: number } = {}, ): Promise { const timeout = opts.timeout ?? 30_000; - // `opencli list -f json` already weighs ~1 MB at 1030 entries on v1.8.2 and - // grows with every new adapter. The execFile default maxBuffer is 1 MB; past - // it stdout overflows and the helper returns code - // 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER' instead of the actual exit code. - const maxBuffer = opts.maxBuffer ?? 16 * 1024 * 1024; + const maxBuffer = opts.maxBuffer ?? DEFAULT_MAX_BUFFER_BYTES; try { const runtime = process.env.OPENCLI_TEST_RUNTIME || 'node'; const { stdout, stderr } = await exec(runtime, [MAIN, ...args], {