From 3a9a4673084c2b625b9a2475803f5bb67a80c8ee Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 25 May 2025 21:00:38 +0200 Subject: [PATCH] Fix missing args test to properly capture error output --- scripts/prepare-release.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/prepare-release.js b/scripts/prepare-release.js index d49c119..ec226e8 100755 --- a/scripts/prepare-release.js +++ b/scripts/prepare-release.js @@ -552,14 +552,25 @@ function checkSwiftCLIIntegration() { } // Test 2: Missing required arguments for window mode - const missingArgs = exec('./peekaboo image --mode window --json-output 2>&1', { allowFailure: true }); - if (!missingArgs) { + let missingArgsOutput; + try { + missingArgsOutput = execSync('./peekaboo image --mode window --json-output 2>&1', { + cwd: projectRoot, + encoding: 'utf8', + stdio: 'pipe' + }); + } catch (error) { + // Command fails with non-zero exit code, but we want the output + missingArgsOutput = error.stdout || error.stderr || ''; + } + + if (!missingArgsOutput) { logError('Swift CLI should produce output for missing --app with window mode'); return false; } try { - const errorData = JSON.parse(missingArgs); + const errorData = JSON.parse(missingArgsOutput); if (!errorData.error || errorData.success !== false) { logError('Swift CLI should return error JSON for missing --app with window mode'); return false;