mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-04-27 15:07:41 +00:00
Fix missing args test to properly capture error output
This commit is contained in:
parent
93a1baf596
commit
3a9a467308
1 changed files with 14 additions and 3 deletions
|
|
@ -552,14 +552,25 @@ function checkSwiftCLIIntegration() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test 2: Missing required arguments for window mode
|
// Test 2: Missing required arguments for window mode
|
||||||
const missingArgs = exec('./peekaboo image --mode window --json-output 2>&1', { allowFailure: true });
|
let missingArgsOutput;
|
||||||
if (!missingArgs) {
|
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');
|
logError('Swift CLI should produce output for missing --app with window mode');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const errorData = JSON.parse(missingArgs);
|
const errorData = JSON.parse(missingArgsOutput);
|
||||||
if (!errorData.error || errorData.success !== false) {
|
if (!errorData.error || errorData.success !== false) {
|
||||||
logError('Swift CLI should return error JSON for missing --app with window mode');
|
logError('Swift CLI should return error JSON for missing --app with window mode');
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue