Skip to content

Commit 3b8d2fa

Browse files
committed
Merge branch 'master' into cypress_npm_install_cli
2 parents 2d180d5 + 4a7acc7 commit 3b8d2fa

File tree

8 files changed

+25
-3
lines changed

8 files changed

+25
-3
lines changed

bin/commands/generateDownloads.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ module.exports = async function generateDownloads(args) {
3434
logger.error(err);
3535
utils.setUsageReportingFlag(null, args.disableUsageReporting);
3636
utils.sendUsageReport(null, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err));
37+
process.exitCode = Constants.ERROR_EXIT_CODE;
3738
});
3839
};

bin/commands/generateReport.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ module.exports = function generateReport(args) {
3535
logger.error(err);
3636
utils.setUsageReportingFlag(null, args.disableUsageReporting);
3737
utils.sendUsageReport(null, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err));
38+
process.exitCode = Constants.ERROR_EXIT_CODE;
3839
});
3940
};

bin/commands/info.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,6 @@ module.exports = function info(args) {
9696
logger.error(err);
9797
utils.setUsageReportingFlag(null, args.disableUsageReporting);
9898
utils.sendUsageReport(null, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err));
99+
process.exitCode = Constants.ERROR_EXIT_CODE;
99100
})
100101
}

bin/commands/runs.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ module.exports = function run(args) {
196196
await utils.stopLocalBinary(bsConfig, bs_local, args);
197197

198198
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'build_failed');
199+
process.exitCode = Constants.ERROR_EXIT_CODE;
199200
});
200201
}).catch(function (err) {
201202
// Zip Upload failed | Local Start failed
@@ -212,6 +213,7 @@ module.exports = function run(args) {
212213
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed');
213214
}
214215
}
216+
process.exitCode = Constants.ERROR_EXIT_CODE;
215217
});
216218
}).catch(function (err) {
217219
// Zipping failed
@@ -228,6 +230,7 @@ module.exports = function run(args) {
228230
} catch (err) {
229231
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed');
230232
}
233+
process.exitCode = Constants.ERROR_EXIT_CODE;
231234
});
232235
}).catch(function (err) {
233236
// package installer failed
@@ -239,12 +242,14 @@ module.exports = function run(args) {
239242
} catch (err) {
240243
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed');
241244
}
245+
process.exitCode = Constants.ERROR_EXIT_CODE;
242246
});
243247
}).catch(function (err) {
244248
// md5 check failed
245249
logger.error(err);
246250
logger.error(Constants.userMessages.FAILED_MD5_CHECK);
247251
utils.sendUsageReport(bsConfig, args, Constants.userMessages.MD5_CHECK_FAILED, Constants.messageTypes.ERROR, 'zip_already_uploaded_failed');
252+
process.exitCode = Constants.ERROR_EXIT_CODE;
248253
});
249254
}).catch(function (err) {
250255
// browerstack.json is not valid
@@ -258,10 +263,12 @@ module.exports = function run(args) {
258263

259264
let error_code = utils.getErrorCodeFromMsg(err);
260265
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.validationMessages.NOT_VALID}`, Constants.messageTypes.ERROR, error_code);
266+
process.exitCode = Constants.ERROR_EXIT_CODE;
261267
});
262268
}).catch(function (err) {
263269
logger.error(err);
264270
utils.setUsageReportingFlag(null, args.disableUsageReporting);
265271
utils.sendUsageReport(null, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err));
272+
process.exitCode = Constants.ERROR_EXIT_CODE;
266273
});
267274
}

bin/commands/stop.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,6 @@ module.exports = function stop(args) {
9292
logger.error(err);
9393
utils.setUsageReportingFlag(null, args.disableUsageReporting);
9494
utils.sendUsageReport(null, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err));
95+
process.exitCode = Constants.ERROR_EXIT_CODE;
9596
})
9697
}

bin/helpers/buildArtifacts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ exports.downloadBuildArtifacts = async (bsConfig, buildId, args) => {
193193
messageType = Constants.messageTypes.ERROR;
194194
message = Constants.userMessages.DOWNLOAD_BUILD_ARTIFACTS_FAILED.replace('<build-id>', buildId).replace('<machine-count>', BUILD_ARTIFACTS_FAIL_COUNT);
195195
logger.error(message);
196+
process.exitCode = Constants.ERROR_EXIT_CODE;
196197
} else {
197198
messageType = Constants.messageTypes.SUCCESS;
198199
message = Constants.userMessages.DOWNLOAD_BUILD_ARTIFACTS_SUCCESS.replace('<build-id>', buildId).replace('<user-path>', process.cwd());
@@ -214,5 +215,6 @@ exports.downloadBuildArtifacts = async (bsConfig, buildId, args) => {
214215
}
215216

216217
utils.sendUsageReport(bsConfig, args, err, messageType, errorCode);
218+
process.exitCode = Constants.ERROR_EXIT_CODE;
217219
}
218220
};

bin/helpers/constants.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ const usageReportingConstants = {
205205

206206
const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm
207207

208+
const ERROR_EXIT_CODE = 1;
209+
208210
module.exports = Object.freeze({
209211
syncCLI,
210212
userMessages,
@@ -221,5 +223,6 @@ module.exports = Object.freeze({
221223
SPEC_TOTAL_CHAR_LIMIT,
222224
METADATA_CHAR_BUFFER_PER_SPEC,
223225
usageReportingConstants,
224-
LATEST_VERSION_SYNTAX_REGEX
226+
LATEST_VERSION_SYNTAX_REGEX,
227+
ERROR_EXIT_CODE
225228
});

bin/helpers/reporterHTML.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ function generateCypressCombinationSpecReportDataWithConfigJson(combination){
277277
});
278278
combination.tests = sessionTests;
279279
resolve(combination.tests);
280-
} catch (error) { reject(error) }
280+
} catch (error) {
281+
process.exitCode = Constants.ERROR_EXIT_CODE;
282+
reject(error);
283+
}
281284
})
282285
}
283286

@@ -308,7 +311,10 @@ function generateCypressCombinationSpecReportDataWithoutConfigJson(combination){
308311
});
309312
combination.tests = sessionTests;
310313
resolve(combination.tests);
311-
} catch (error) { reject(error) }
314+
} catch (error) {
315+
process.exitCode = Constants.ERROR_EXIT_CODE;
316+
reject(error);
317+
}
312318
})
313319
}
314320

0 commit comments

Comments
 (0)