Fix invalid command test to properly capture error output

This commit is contained in:
Peter Steinberger 2025-05-25 19:38:14 +02:00
parent 7fadd6e5f1
commit 61d6ef0cee

View file

@ -533,9 +533,21 @@ function checkSwiftCLIIntegration() {
log('Testing Swift CLI error handling and edge cases...', colors.cyan);
// Test 1: Invalid command (since image is default, this gets interpreted as image subcommand argument)
const invalidCmd = exec('./peekaboo invalid-command 2>&1', { allowFailure: true });
if (!invalidCmd || !invalidCmd.includes('Unexpected argument')) {
logError('Swift CLI should show error for invalid command');
let invalidOutput;
try {
execSync('./peekaboo invalid-command 2>&1', {
cwd: projectRoot,
encoding: 'utf8',
stdio: 'pipe'
});
logError('Swift CLI should fail for invalid command');
return false;
} catch (error) {
invalidOutput = error.stdout || error.stderr || error.toString();
}
if (!invalidOutput.includes('Unexpected argument')) {
logError('Swift CLI should show proper error for invalid command');
return false;
}