Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions bin/commands/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ module.exports = function run(args, rawArgs) {
logger.debug("Completed archiving test suite");
markBlockEnd('zip.archive');

//setup Local Testing
markBlockStart('localSetup');
logger.debug("Started setting up BrowserStack Local connection");
let bs_local = await utils.setupLocalTesting(bsConfig, args, rawArgs, buildReportData);
logger.debug('Completed setting up BrowserStack Local connection');
markBlockEnd('localSetup');

let test_zip_size = utils.fetchZipSize(path.join(process.cwd(), config.fileName));
let npm_zip_size = utils.fetchZipSize(path.join(process.cwd(), config.packageFileName));
let node_modules_size = await utils.fetchFolderSize(path.join(process.cwd(), "node_modules"))
Expand All @@ -233,12 +240,6 @@ module.exports = function run(args, rawArgs) {
markBlockEnd('zip');

// Create build
//setup Local Testing
markBlockStart('localSetup');
logger.debug("Started setting up BrowserStack Local connection");
let bs_local = await utils.setupLocalTesting(bsConfig, args, rawArgs, buildReportData);
logger.debug('Completed setting up BrowserStack Local connection');
markBlockEnd('localSetup');
logger.debug("Started build creation");
markBlockStart('createBuild');
return build.createBuild(bsConfig, zip).then(function (data) {
Expand Down Expand Up @@ -380,9 +381,11 @@ module.exports = function run(args, rawArgs) {
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'build_failed', buildReportData, rawArgs);
process.exitCode = Constants.ERROR_EXIT_CODE;
});
}).catch(function (err) {
}).catch(async function (err) {
// Zip Upload failed | Local Start failed
logger.error(err);
// stop the Local instance
await utils.stopLocalBinary(bsConfig, bs_local, args, rawArgs, buildReportData);
if(err === Constants.userMessages.LOCAL_START_FAILED){
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.LOCAL_START_FAILED}`, Constants.messageTypes.ERROR, 'local_start_failed', buildReportData, rawArgs);
} else {
Expand Down
10 changes: 9 additions & 1 deletion bin/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,15 @@ exports.setLocalMode = (bsConfig, args) => {
exports.setupLocalTesting = (bsConfig, args, rawArgs, buildReportData) => {
return new Promise(async (resolve, reject) => {
if( bsConfig['connection_settings'] && bsConfig['connection_settings']['local'] && String(bsConfig['connection_settings']['local']) === "true" ){
let localBinaryRunning = await this.checkLocalBinaryRunning(bsConfig, bsConfig['connection_settings']['local_identifier']);
let localBinaryRunning;
try {
localBinaryRunning = await this.checkLocalBinaryRunning(bsConfig, bsConfig['connection_settings']['local_identifier']);
} catch(error) {
logger.debug(`Failed to check if a local binary is already running for a user with the error: ${error}`);
localBinaryRunning = {
should_spawn_binary: true
};
}
let localIdentifierRunning;
if (localBinaryRunning['should_spawn_binary'] == true) {
localIdentifierRunning = false;
Expand Down