browserstack-cypress-cli
Advanced tools
Comparing version 1.14.0 to 1.14.1
@@ -6,3 +6,4 @@ 'use strict'; | ||
utils = require("../helpers/utils"), | ||
downloadBuildArtifacts = require('../helpers/buildArtifacts').downloadBuildArtifacts; | ||
downloadBuildArtifacts = require('../helpers/buildArtifacts').downloadBuildArtifacts, | ||
getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails; | ||
@@ -23,2 +24,4 @@ | ||
let buildReportData = await getInitialDetails(bsConfig, args, rawArgs); | ||
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting); | ||
@@ -33,4 +36,4 @@ | ||
await downloadBuildArtifacts(bsConfig, buildId, args, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, Constants.usageReportingConstants.GENERATE_DOWNLOADS, messageType, errorCode, null, rawArgs); | ||
await downloadBuildArtifacts(bsConfig, buildId, args, rawArgs, buildReportData); | ||
utils.sendUsageReport(bsConfig, args, Constants.usageReportingConstants.GENERATE_DOWNLOADS, messageType, errorCode, buildReportData, rawArgs); | ||
}).catch(function (err) { | ||
@@ -37,0 +40,0 @@ logger.error(err); |
@@ -6,3 +6,4 @@ 'use strict'; | ||
utils = require("../helpers/utils"), | ||
reporterHTML = require('../helpers/reporterHTML'); | ||
reporterHTML = require('../helpers/reporterHTML'), | ||
getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails; | ||
@@ -24,13 +25,18 @@ | ||
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting); | ||
getInitialDetails(bsConfig, args, rawArgs).then((buildReportData) => { | ||
// set cypress config filename | ||
utils.setCypressConfigFilename(bsConfig, args); | ||
let messageType = Constants.messageTypes.INFO; | ||
let errorCode = null; | ||
let buildId = args._[1]; | ||
reportGenerator(bsConfig, buildId, args, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, 'generate-report called', messageType, errorCode, null, rawArgs); | ||
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting); | ||
// set cypress config filename | ||
utils.setCypressConfigFilename(bsConfig, args); | ||
let messageType = Constants.messageTypes.INFO; | ||
let errorCode = null; | ||
let buildId = args._[1]; | ||
reportGenerator(bsConfig, buildId, args, rawArgs, buildReportData); | ||
utils.sendUsageReport(bsConfig, args, 'generate-report called', messageType, errorCode, buildReportData, rawArgs); | ||
}).catch((err) => { | ||
logger.warn(err); | ||
}); | ||
}).catch(function (err) { | ||
@@ -37,0 +43,0 @@ logger.error(err); |
@@ -7,3 +7,4 @@ 'use strict'; | ||
Constants = require("../helpers/constants"), | ||
utils = require("../helpers/utils"); | ||
utils = require("../helpers/utils"), | ||
getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails; | ||
@@ -22,78 +23,82 @@ module.exports = function info(args, rawArgs) { | ||
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting); | ||
getInitialDetails(bsConfig, args, rawArgs).then((buildReportData) => { | ||
// set cypress config filename | ||
utils.setCypressConfigFilename(bsConfig, args); | ||
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting); | ||
let buildId = args._[1]; | ||
// set cypress config filename | ||
utils.setCypressConfigFilename(bsConfig, args); | ||
let options = { | ||
url: config.buildUrl + buildId, | ||
auth: { | ||
user: bsConfig.auth.username, | ||
password: bsConfig.auth.access_key, | ||
}, | ||
headers: { | ||
'User-Agent': utils.getUserAgent(), | ||
}, | ||
}; | ||
let buildId = args._[1]; | ||
request.get(options, function (err, resp, body) { | ||
let message = null; | ||
let messageType = null; | ||
let errorCode = null; | ||
if (err) { | ||
message = Constants.userMessages.BUILD_INFO_FAILED; | ||
messageType = Constants.messageTypes.ERROR; | ||
errorCode = 'api_failed_build_info'; | ||
logger.info(message); | ||
logger.error(utils.formatRequest(err, resp, body)); | ||
} else { | ||
let build = null; | ||
try { | ||
build = JSON.parse(body); | ||
} catch (error) { | ||
build = null; | ||
} | ||
if (resp.statusCode == 299) { | ||
messageType = Constants.messageTypes.INFO; | ||
errorCode = 'api_deprecated'; | ||
if (build) { | ||
message = build.message; | ||
logger.info(message); | ||
} else { | ||
message = Constants.userMessages.API_DEPRECATED; | ||
logger.info(message); | ||
} | ||
logger.info(utils.formatRequest(err, resp, body)); | ||
} else if (resp.statusCode != 200) { | ||
let options = { | ||
url: config.buildUrl + buildId, | ||
auth: { | ||
user: bsConfig.auth.username, | ||
password: bsConfig.auth.access_key, | ||
}, | ||
headers: { | ||
'User-Agent': utils.getUserAgent(), | ||
}, | ||
}; | ||
request.get(options, function (err, resp, body) { | ||
let message = null; | ||
let messageType = null; | ||
let errorCode = null; | ||
if (err) { | ||
message = Constants.userMessages.BUILD_INFO_FAILED; | ||
messageType = Constants.messageTypes.ERROR; | ||
errorCode = 'api_failed_build_info'; | ||
if (build) { | ||
message = `${ | ||
Constants.userMessages.BUILD_INFO_FAILED | ||
} with error: \n${JSON.stringify(build, null, 2)}`; | ||
logger.error(message); | ||
if (build.message === 'Unauthorized') errorCode = 'api_auth_failed'; | ||
logger.info(message); | ||
logger.error(utils.formatRequest(err, resp, body)); | ||
} else { | ||
let build = null; | ||
try { | ||
build = JSON.parse(body); | ||
} catch (error) { | ||
build = null; | ||
} | ||
if (resp.statusCode == 299) { | ||
messageType = Constants.messageTypes.INFO; | ||
errorCode = 'api_deprecated'; | ||
if (build) { | ||
message = build.message; | ||
logger.info(message); | ||
} else { | ||
message = Constants.userMessages.API_DEPRECATED; | ||
logger.info(message); | ||
} | ||
logger.info(utils.formatRequest(err, resp, body)); | ||
} else if (resp.statusCode != 200) { | ||
messageType = Constants.messageTypes.ERROR; | ||
errorCode = 'api_failed_build_info'; | ||
if (build) { | ||
message = `${ | ||
Constants.userMessages.BUILD_INFO_FAILED | ||
} with error: \n${JSON.stringify(build, null, 2)}`; | ||
logger.error(message); | ||
if (build.message === 'Unauthorized') errorCode = 'api_auth_failed'; | ||
} else { | ||
message = Constants.userMessages.BUILD_INFO_FAILED; | ||
logger.error(message); | ||
} | ||
logger.error(utils.formatRequest(err, resp, body)); | ||
} else { | ||
message = Constants.userMessages.BUILD_INFO_FAILED; | ||
logger.error(message); | ||
messageType = Constants.messageTypes.SUCCESS; | ||
message = `Build info for build id: \n ${JSON.stringify( | ||
build, | ||
null, | ||
2 | ||
)}`; | ||
logger.info(message); | ||
} | ||
logger.error(utils.formatRequest(err, resp, body)); | ||
} else { | ||
messageType = Constants.messageTypes.SUCCESS; | ||
message = `Build info for build id: \n ${JSON.stringify( | ||
build, | ||
null, | ||
2 | ||
)}`; | ||
logger.info(message); | ||
} | ||
} | ||
utils.sendUsageReport(bsConfig, args, message, messageType, errorCode, null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, message, messageType, errorCode, buildReportData, rawArgs); | ||
}); | ||
}).catch((err) => { | ||
logger.warn(err); | ||
}); | ||
@@ -100,0 +105,0 @@ }).catch(function (err) { |
@@ -13,2 +13,3 @@ 'use strict'; | ||
fileHelpers = require("../helpers/fileHelpers"), | ||
getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails, | ||
syncRunner = require("../helpers/syncRunner"), | ||
@@ -56,2 +57,4 @@ checkUploaded = require("../helpers/checkUploaded"), | ||
let buildReportData = await getInitialDetails(bsConfig, args, rawArgs); | ||
// accept the build name from command line if provided | ||
@@ -133,3 +136,3 @@ utils.setBuildName(bsConfig, args); | ||
// warn if specFiles cross our limit | ||
utils.warnSpecLimit(bsConfig, args, specFiles, rawArgs); | ||
utils.warnSpecLimit(bsConfig, args, specFiles, rawArgs, buildReportData); | ||
markBlockEnd('preArchiveSteps'); | ||
@@ -174,3 +177,3 @@ logger.debug("Completed pre-archive steps"); | ||
logger.debug("Started setting up BrowserStack Local connection"); | ||
let bs_local = await utils.setupLocalTesting(bsConfig, args, rawArgs); | ||
let bs_local = await utils.setupLocalTesting(bsConfig, args, rawArgs, buildReportData); | ||
logger.debug('Completed setting up BrowserStack Local connection'); | ||
@@ -184,10 +187,6 @@ markBlockEnd('localSetup'); | ||
markBlockEnd('total'); | ||
utils.setProcessHooks(data.build_id, bsConfig, bs_local, args); | ||
utils.setProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData); | ||
let message = `${data.message}! ${Constants.userMessages.BUILD_CREATED} with build id: ${data.build_id}`; | ||
let dashboardLink = `${Constants.userMessages.VISIT_DASHBOARD} ${data.dashboard_url}`; | ||
let buildReportData = { | ||
'build_id': data.build_id, | ||
'user_id': data.user_id, | ||
'parallels': userSpecifiedParallels | ||
}; | ||
buildReportData = { 'build_id': data.build_id, 'parallels': userSpecifiedParallels, ...buildReportData } | ||
utils.exportResults(data.build_id, `${config.dashboardUrl}${data.build_id}`); | ||
@@ -216,7 +215,7 @@ if ((utils.isUndefined(bsConfig.run_settings.parallels) && utils.isUndefined(args.parallels)) || (!utils.isUndefined(bsConfig.run_settings.parallels) && bsConfig.run_settings.parallels == Constants.cliMessages.RUN.DEFAULT_PARALLEL_MESSAGE)) { | ||
logger.debug("Started polling build status from BrowserStack"); | ||
syncRunner.pollBuildStatus(bsConfig, data, rawArgs).then(async (exitCode) => { | ||
syncRunner.pollBuildStatus(bsConfig, data, rawArgs, buildReportData).then(async (exitCode) => { | ||
logger.debug("Completed polling of build status"); | ||
// stop the Local instance | ||
await utils.stopLocalBinary(bsConfig, bs_local, args, rawArgs); | ||
await utils.stopLocalBinary(bsConfig, bs_local, args, rawArgs, buildReportData); | ||
@@ -230,7 +229,7 @@ // waiting for 5 secs for upload to complete (as a safety measure) | ||
logger.debug("Downloading build artifacts"); | ||
await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs); | ||
await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData); | ||
} | ||
// Generate custom report! | ||
reportGenerator(bsConfig, data.build_id, args, rawArgs, function(){ | ||
reportGenerator(bsConfig, data.build_id, args, rawArgs, buildReportData, function(){ | ||
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null, buildReportData, rawArgs); | ||
@@ -309,5 +308,5 @@ utils.handleSyncExit(exitCode, data.dashboard_url); | ||
// stop the Local instance | ||
await utils.stopLocalBinary(bsConfig, bs_local, args, rawArgs); | ||
await utils.stopLocalBinary(bsConfig, bs_local, args, rawArgs, buildReportData); | ||
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'build_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'build_failed', buildReportData, rawArgs); | ||
process.exitCode = Constants.ERROR_EXIT_CODE; | ||
@@ -319,11 +318,11 @@ }); | ||
if(err === Constants.userMessages.LOCAL_START_FAILED){ | ||
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.LOCAL_START_FAILED}`, Constants.messageTypes.ERROR, 'local_start_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.LOCAL_START_FAILED}`, Constants.messageTypes.ERROR, 'local_start_failed', buildReportData, rawArgs); | ||
} else { | ||
logger.error(Constants.userMessages.ZIP_UPLOAD_FAILED); | ||
fileHelpers.deleteZip(); | ||
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.ZIP_UPLOAD_FAILED}`, Constants.messageTypes.ERROR, 'zip_upload_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.ZIP_UPLOAD_FAILED}`, Constants.messageTypes.ERROR, 'zip_upload_failed', buildReportData, rawArgs); | ||
try { | ||
fileHelpers.deletePackageArchieve(); | ||
} catch (err) { | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed', buildReportData, rawArgs); | ||
} | ||
@@ -337,7 +336,7 @@ } | ||
logger.error(Constants.userMessages.FAILED_TO_ZIP); | ||
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.FAILED_TO_ZIP}`, Constants.messageTypes.ERROR, 'zip_creation_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.FAILED_TO_ZIP}`, Constants.messageTypes.ERROR, 'zip_creation_failed', buildReportData, rawArgs); | ||
try { | ||
fileHelpers.deleteZip(); | ||
} catch (err) { | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.ZIP_DELETE_FAILED, Constants.messageTypes.ERROR, 'zip_deletion_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.ZIP_DELETE_FAILED, Constants.messageTypes.ERROR, 'zip_deletion_failed', buildReportData, rawArgs); | ||
} | ||
@@ -347,3 +346,3 @@ try { | ||
} catch (err) { | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed', buildReportData, rawArgs); | ||
} | ||
@@ -356,7 +355,7 @@ process.exitCode = Constants.ERROR_EXIT_CODE; | ||
logger.error(Constants.userMessages.FAILED_CREATE_NPM_ARCHIVE); | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.FAILED_CREATE_NPM_ARCHIVE, Constants.messageTypes.ERROR, 'npm_package_archive_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.FAILED_CREATE_NPM_ARCHIVE, Constants.messageTypes.ERROR, 'npm_package_archive_failed', buildReportData, rawArgs); | ||
try { | ||
fileHelpers.deletePackageArchieve(); | ||
} catch (err) { | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.NPM_DELETE_FAILED, Constants.messageTypes.ERROR, 'npm_deletion_failed', buildReportData, rawArgs); | ||
} | ||
@@ -369,3 +368,3 @@ process.exitCode = Constants.ERROR_EXIT_CODE; | ||
logger.error(Constants.userMessages.FAILED_MD5_CHECK); | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.MD5_CHECK_FAILED, Constants.messageTypes.ERROR, 'zip_already_uploaded_failed', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, Constants.userMessages.MD5_CHECK_FAILED, Constants.messageTypes.ERROR, 'zip_already_uploaded_failed', buildReportData, rawArgs); | ||
process.exitCode = Constants.ERROR_EXIT_CODE; | ||
@@ -384,3 +383,3 @@ }); | ||
let error_code = utils.getErrorCodeFromMsg(err); | ||
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.validationMessages.NOT_VALID}`, Constants.messageTypes.ERROR, error_code, null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.validationMessages.NOT_VALID}`, Constants.messageTypes.ERROR, error_code, buildReportData, rawArgs); | ||
process.exitCode = Constants.ERROR_EXIT_CODE; | ||
@@ -387,0 +386,0 @@ }); |
@@ -7,3 +7,4 @@ 'use strict'; | ||
Constants = require("../helpers/constants"), | ||
utils = require("../helpers/utils"); | ||
utils = require("../helpers/utils"), | ||
getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails; | ||
@@ -22,2 +23,4 @@ module.exports = function stop(args, rawArgs) { | ||
let buildReportData = await getInitialDetails(bsConfig, args, rawArgs); | ||
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting); | ||
@@ -30,3 +33,3 @@ | ||
await utils.stopBrowserStackBuild(bsConfig, args, buildId, rawArgs); | ||
await utils.stopBrowserStackBuild(bsConfig, args, buildId, rawArgs, buildReportData); | ||
@@ -33,0 +36,0 @@ }).catch(function (err) { |
@@ -137,3 +137,3 @@ 'use strict'; | ||
const sendUpdatesToBstack = async (bsConfig, buildId, args, options, rawArgs) => { | ||
const sendUpdatesToBstack = async (bsConfig, buildId, args, options, rawArgs, buildReportData) => { | ||
options.url = `${config.buildUrl}${buildId}/build_artifacts/status`; | ||
@@ -165,3 +165,3 @@ | ||
if(err) { | ||
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'api_failed_build_artifacts_status_update', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'api_failed_build_artifacts_status_update', buildReportData, rawArgs); | ||
logger.error(utils.formatRequest(err, resp, data)); | ||
@@ -177,3 +177,3 @@ reject(err); | ||
if (responseData && responseData["error"]) { | ||
utils.sendUsageReport(bsConfig, args, responseData["error"], Constants.messageTypes.ERROR, 'api_failed_build_artifacts_status_update', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, responseData["error"], Constants.messageTypes.ERROR, 'api_failed_build_artifacts_status_update', buildReportData, rawArgs); | ||
reject(responseData["error"]) | ||
@@ -188,3 +188,3 @@ } | ||
exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs) => { | ||
exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null) => { | ||
return new Promise ( async (resolve, reject) => { | ||
@@ -212,3 +212,3 @@ BUILD_ARTIFACTS_FAIL_COUNT = 0; | ||
logger.error(utils.formatRequest(err, resp, body)); | ||
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'api_failed_build_artifacts', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'api_failed_build_artifacts', buildReportData, rawArgs); | ||
process.exitCode = Constants.ERROR_EXIT_CODE; | ||
@@ -222,3 +222,3 @@ } else { | ||
logger.error(utils.formatRequest(err, resp, body)); | ||
utils.sendUsageReport(bsConfig, args, buildDetails, Constants.messageTypes.ERROR, 'api_failed_build_artifacts', null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, buildDetails, Constants.messageTypes.ERROR, 'api_failed_build_artifacts', buildReportData, rawArgs); | ||
process.exitCode = Constants.ERROR_EXIT_CODE; | ||
@@ -238,4 +238,4 @@ } else { | ||
} | ||
await sendUpdatesToBstack(bsConfig, buildId, args, options, rawArgs) | ||
utils.sendUsageReport(bsConfig, args, message, messageType, null, null, rawArgs); | ||
await sendUpdatesToBstack(bsConfig, buildId, args, options, rawArgs, buildReportData) | ||
utils.sendUsageReport(bsConfig, args, message, messageType, null, buildReportData, rawArgs); | ||
} | ||
@@ -252,3 +252,3 @@ } catch (err) { | ||
} | ||
utils.sendUsageReport(bsConfig, args, err, messageType, errorCode, null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, err, messageType, errorCode, buildReportData, rawArgs); | ||
logger.error(`Error: Request failed with status code ${resp.statusCode}`) | ||
@@ -255,0 +255,0 @@ logger.error(utils.formatRequest(err, resp, body)); |
@@ -19,2 +19,3 @@ var config = require('./config.json'); | ||
config.checkMd5sum = `${config.cypress_v1}/md5sumcheck/`; | ||
config.getInitialDetails = `${config.cypress_v1}/get_initial_details/`; | ||
config.fileName = "tests.zip"; | ||
@@ -21,0 +22,0 @@ config.packageFileName = "bstackPackages.tar.gz"; |
@@ -91,3 +91,3 @@ const fs = require('fs'), | ||
let reportGenerator = (bsConfig, buildId, args, rawArgs, cb) => { | ||
let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) => { | ||
let options = { | ||
@@ -118,3 +118,3 @@ url: `${config.buildUrl}${buildId}/custom_report`, | ||
utils.sendUsageReport(bsConfig, args, message, messageType, errorCode, null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, message, messageType, errorCode, buildReportData, rawArgs); | ||
return; | ||
@@ -171,3 +171,3 @@ } else { | ||
} | ||
utils.sendUsageReport(bsConfig, args, message, messageType, errorCode, null, rawArgs); | ||
utils.sendUsageReport(bsConfig, args, message, messageType, errorCode, buildReportData, rawArgs); | ||
if (cb){ | ||
@@ -174,0 +174,0 @@ cb(); |
@@ -41,6 +41,3 @@ const tablePrinter = require('table'), // { table, getBorderCharacters } | ||
let specStatus = | ||
spec.status && spec.status.toLowerCase() === 'failed' | ||
? chalk.red(spec.status) | ||
: chalk.yellow(spec.status); | ||
let specStatus = getSpecStatus(spec.status) | ||
specData.push([ | ||
@@ -83,2 +80,13 @@ spec.specName, | ||
let getSpecStatus = (specStatus) => { | ||
switch(specStatus.toLowerCase()) { | ||
case 'failed': return chalk.red(specStatus); | ||
case 'pending': | ||
case 'skipped': | ||
case 'passed_with_skipped': return chalk.blueBright(specStatus); | ||
default: return chalk.yellow(specStatus); | ||
} | ||
} | ||
exports.failedSpecsDetails = failedSpecsDetails; | ||
exports.getSpecStatus = getSpecStatus; |
@@ -26,3 +26,5 @@ const logger = require("../logger").syncCliLogger; | ||
passed: 0, | ||
skipped: 0 | ||
skipped: 0, | ||
passed_with_skipped: 0, | ||
pending: 0 | ||
}; | ||
@@ -34,3 +36,3 @@ | ||
logger.info(`Total tests: ${summary.total}, passed: ${summary.passed}, failed: ${summary.failed}, skipped: ${summary.skipped}`); | ||
logger.info(`Total tests: ${summary.total}, passed: ${summary.passed}, failed: ${summary.failed}, skipped: ${summary.skipped}, passed_with_skipped: ${summary.passed_with_skipped}, pending: ${summary.pending}`); | ||
logger.info(`Done in ${data.duration/1000} seconds using ${machines} machines\n`); | ||
@@ -62,5 +64,11 @@ | ||
break; | ||
case "passed_with_skipped": | ||
summary.passed_with_skipped++; | ||
break; | ||
case 'skipped': | ||
summary.skipped++; | ||
break; | ||
case "pending": | ||
summary.pending++; | ||
break; | ||
case 'passed': | ||
@@ -67,0 +75,0 @@ summary.passed++; |
@@ -99,3 +99,3 @@ "use strict"; | ||
let printSpecsStatus = (bsConfig, buildDetails, rawArgs) => { | ||
let printSpecsStatus = (bsConfig, buildDetails, rawArgs, buildReportData) => { | ||
setNoWrapParams(); | ||
@@ -120,3 +120,3 @@ return new Promise((resolve, reject) => { | ||
} else { | ||
utils.sendUsageReport(bsConfig, {}, `buildId: ${buildDetails.build_id}`, 'error', 'sync_cli_error', err, rawArgs); | ||
utils.sendUsageReport(bsConfig, {}, `buildId: ${buildDetails.build_id}`, 'error', 'sync_cli_error', { ...err , ...buildReportData}, rawArgs); | ||
} | ||
@@ -206,9 +206,10 @@ } | ||
let combination = getCombinationName(data["spec"]); | ||
let status = getStatus(data["spec"]["status"]); | ||
writeToTable(combination, data["path"], status) | ||
addSpecToSummary(data["path"], data["spec"]["status"], combination, data["session_id"]) | ||
let status = data["spec"]["status"]; | ||
let statusMark = getStatus(status); | ||
writeToTable(combination, data["path"], status, statusMark) | ||
addSpecToSummary(data["path"], status, combination, data["session_id"]) | ||
} | ||
let writeToTable = (combination, specName, status) => { | ||
stream.write([combination , ":", `${specName} ${status}`]); | ||
let writeToTable = (combination, specName, status, statusMark) => { | ||
stream.write([combination , ":", `${specName} ${statusMark} [${status}]`]); | ||
} | ||
@@ -247,2 +248,4 @@ | ||
return chalk.red("✘"); | ||
case "passed_with_skipped": | ||
return chalk.blueBright("✔"); | ||
default: | ||
@@ -249,0 +252,0 @@ return chalk.blue(`[${status}]`); |
@@ -6,6 +6,6 @@ 'use strict'; | ||
exports.pollBuildStatus = (bsConfig, buildDetails) => { | ||
exports.pollBuildStatus = (bsConfig, buildDetails, rawArgs, buildReportData) => { | ||
let customErrorsToPrint; | ||
return new Promise((resolve, reject) => { | ||
syncSpecsLogs.printSpecsStatus(bsConfig, buildDetails).then((data) => { | ||
syncSpecsLogs.printSpecsStatus(bsConfig, buildDetails, rawArgs, buildReportData).then((data) => { | ||
if(data.customErrorsToPrint && data.customErrorsToPrint.length > 0) { | ||
@@ -12,0 +12,0 @@ customErrorsToPrint = data.customErrorsToPrint; |
@@ -185,3 +185,3 @@ "use strict"; | ||
exports.warnSpecLimit = (bsConfig, args, specFiles, rawArgs) => { | ||
exports.warnSpecLimit = (bsConfig, args, specFiles, rawArgs, buildReportData) => { | ||
let expectedCharLength = specFiles.join("").length + Constants.METADATA_CHAR_BUFFER_PER_SPEC * specFiles.length; | ||
@@ -200,3 +200,3 @@ let parallels = bsConfig.run_settings.parallels; | ||
null, | ||
null, | ||
buildReportData, | ||
rawArgs | ||
@@ -720,3 +720,3 @@ ); | ||
exports.setupLocalTesting = (bsConfig, args, rawArgs) => { | ||
exports.setupLocalTesting = (bsConfig, args, rawArgs, buildReportData) => { | ||
return new Promise(async (resolve, reject) => { | ||
@@ -757,3 +757,3 @@ if( bsConfig['connection_settings'] && bsConfig['connection_settings']['local'] && String(bsConfig['connection_settings']['local']) === "true" ){ | ||
errorCode, | ||
null, | ||
buildReportData, | ||
rawArgs | ||
@@ -773,3 +773,3 @@ ); | ||
exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs) => { | ||
exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs, buildReportData) => { | ||
return new Promise(async (resolve, reject) => { | ||
@@ -791,3 +791,3 @@ if (!this.isUndefined(bs_local) && bs_local.isRunning() && bsConfig['connection_settings'] && bsConfig['connection_settings']['local_mode'].toLowerCase() != "always-on") { | ||
errorCode, | ||
null, | ||
buildReportData, | ||
rawArgs | ||
@@ -1098,3 +1098,3 @@ ); | ||
exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs) => { | ||
exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs, buildReportData = null) => { | ||
let that = this; | ||
@@ -1162,3 +1162,3 @@ return new Promise(function (resolve, reject) { | ||
} finally { | ||
that.sendUsageReport(bsConfig, args, message, messageType, errorCode, null, rawArgs); | ||
that.sendUsageReport(bsConfig, args, message, messageType, errorCode, buildReportData, rawArgs); | ||
} | ||
@@ -1171,3 +1171,3 @@ } | ||
exports.setProcessHooks = (buildId, bsConfig, bsLocal, args) => { | ||
exports.setProcessHooks = (buildId, bsConfig, bsLocal, args, buildReportData) => { | ||
let bindData = { | ||
@@ -1177,3 +1177,4 @@ buildId: buildId, | ||
bsLocalInstance: bsLocal, | ||
args: args | ||
args: args, | ||
buildReportData: buildReportData | ||
} | ||
@@ -1188,4 +1189,4 @@ process.on('SIGINT', processExitHandler.bind(this, bindData)); | ||
logger.warn(Constants.userMessages.PROCESS_KILL_MESSAGE); | ||
await this.stopBrowserStackBuild(exitData.bsConfig, exitData.args, exitData.buildId); | ||
await this.stopLocalBinary(exitData.bsConfig, exitData.bsLocalInstance, exitData.args); | ||
await this.stopBrowserStackBuild(exitData.bsConfig, exitData.args, exitData.buildId, null, exitData.buildReportData); | ||
await this.stopLocalBinary(exitData.bsConfig, exitData.bsLocalInstance, exitData.args, null, exitData.buildReportData); | ||
process.exit(0); | ||
@@ -1192,0 +1193,0 @@ } |
{ | ||
"name": "browserstack-cypress-cli", | ||
"version": "1.14.0", | ||
"version": "1.14.1", | ||
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"async": "3.2.3", | ||
"browserstack-local": "1.4.8", | ||
"browserstack-local": "1.5.1", | ||
"chalk": "4.1.2", | ||
@@ -20,0 +20,0 @@ "cli-progress": "3.10.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
203797
36
4733
+ Addedagent-base@6.0.2(transitive)
+ Addedbrowserstack-local@1.5.1(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
- Removedagent-base@5.1.1(transitive)
- Removedbrowserstack-local@1.4.8(transitive)
- Removedhttps-proxy-agent@4.0.0(transitive)
Updatedbrowserstack-local@1.5.1