Skip to content

Commit d36d666

Browse files
committed
set exitCode while capturing and processing
1 parent ce7adff commit d36d666

File tree

8 files changed

+13
-3
lines changed

8 files changed

+13
-3
lines changed

src/commander/capture.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ command
8787
await tasks.run(ctx);
8888
} catch (error) {
8989
console.log('\nRefer docs: https://www.lambdatest.com/support/docs/smart-visual-regression-testing/');
90+
process.exitCode = 1;
9091
}
9192

9293
})

src/commander/exec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ command
6767
await tasks.run(ctx);
6868
} catch (error) {
6969
ctx.log.info('\nRefer docs: https://www.lambdatest.com/support/docs/smart-visual-regression-testing/');
70+
process.exitCode = 1;
7071
throw new Error();
7172
}
7273
})

src/commander/mergeBuild.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ command
5555
await tasks.run(ctx);
5656
} catch (error) {
5757
console.error('Error during merge operation:', error);
58+
process.exitCode = 1;
5859
}
5960
});
6061

src/commander/upload.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ command
7373
await tasks.run(ctx);
7474
} catch (error) {
7575
console.log('\nRefer docs: https://www.lambdatest.com/support/docs/smart-visual-regression-testing/');
76+
process.exitCode = 1;
7677
}
7778

7879
});

src/commander/uploadFigma.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ uploadWebFigmaCommand
103103
verifyFigmaWebConfig(ctx);
104104
} catch (error: any) {
105105
ctx.log.error(chalk.red(`Invalid figma-web config; ${error.message}`));
106+
process.exitCode = 1;
106107
return;
107108
}
108109

@@ -169,6 +170,7 @@ uploadWebFigmaCommand
169170
verifyFigmaWebConfig(ctx);
170171
} catch (error: any) {
171172
ctx.log.error(chalk.red(`Invalid figma-app config; ${error.message}`));
173+
process.exitCode = 1;
172174
return;
173175
}
174176

src/tasks/createBuild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
1919
baseline: resp.data.baseline,
2020
useKafkaFlow: resp.data.useKafkaFlow || false,
2121
}
22-
process.env.SMARTUI_BUILD = resp.data.buildId;
22+
process.env.SMARTUI_BUILD_ID = resp.data.buildId;
2323
process.env.SMARTUI_BUILD_NAME = resp.data.buildName;
2424
} else if (resp && resp.error) {
2525
if (resp.error.message) {

src/tasks/createBuildExec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
2121
baseline: resp.data.baseline,
2222
useKafkaFlow: resp.data.useKafkaFlow || false,
2323
}
24-
process.env.SMARTUI_BUILD = resp.data.buildId;
24+
process.env.SMARTUI_BUILD_ID = resp.data.buildId;
2525
process.env.SMARTUI_BUILD_NAME = resp.data.buildName;
2626
} else if (resp && resp.error) {
2727
if (resp.error.message) {

src/tasks/processSnapshot.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
2828

2929
let output = '';
3030
for (let snapshot of ctx.snapshotQueue?.getProcessedSnapshots()) {
31-
if (snapshot.error) output += `${chalk.red('\u{2717}')} ${chalk.gray(`${snapshot.name}\n[error] ${snapshot.error}`)}\n`;
31+
if (snapshot.error){
32+
output += `${chalk.red('\u{2717}')} ${chalk.gray(`${snapshot.name}\n[error] ${snapshot.error}`)}\n`;
33+
process.exitCode = 1;
34+
}
3235
else output += `${chalk.green('\u{2713}')} ${chalk.gray(snapshot.name)}\n${snapshot.warnings.length ? chalk.gray(`[warning] ${snapshot.warnings.join('\n[warning] ')}\n`) : ''}`;
3336
}
3437
task.output = output;
3538
task.title = 'Processed snapshots'
3639
} catch (error: any) {
3740
ctx.log.debug(error);
3841
task.output = chalk.gray(error.message);
42+
process.exitCode = 1;
3943
throw new Error('Processing of snapshots failed');
4044
}
4145
},

0 commit comments

Comments
 (0)