diff --git a/bin/accessibility-automation/helper.js b/bin/accessibility-automation/helper.js index 36d484c4..e0ec145f 100644 --- a/bin/accessibility-automation/helper.js +++ b/bin/accessibility-automation/helper.js @@ -10,7 +10,7 @@ const helper = require('../helpers/helper'); const { CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS } = require('../helpers/constants'); const { consoleHolder } = require("../testObservability/helper/constants"); const supportFileContentMap = {} -const HttpsProxyAgent = require('https-proxy-agent'); +const { HttpsProxyAgent = require('https-proxy-agent') } = require('https-proxy-agent'); exports.checkAccessibilityPlatform = (user_config) => { let accessibility = false; diff --git a/bin/commands/runs.js b/bin/commands/runs.js index 8bf716f9..a4e21b5a 100644 --- a/bin/commands/runs.js +++ b/bin/commands/runs.js @@ -471,8 +471,12 @@ module.exports = function run(args, 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', buildReportData, rawArgs); + try { + fileHelpers.deleteZip(); + } catch (err) { + utils.sendUsageReport(bsConfig, args, Constants.userMessages.ZIP_DELETE_FAILED, Constants.messageTypes.ERROR, 'zip_deletion_failed', buildReportData, rawArgs); + } try { fileHelpers.deletePackageArchieve(); } catch (err) { diff --git a/bin/helpers/atsHelper.js b/bin/helpers/atsHelper.js index 3e62ac54..fe3cefa8 100644 --- a/bin/helpers/atsHelper.js +++ b/bin/helpers/atsHelper.js @@ -1,7 +1,7 @@ const path = require('path'); const fs = require('fs'); const { consoleHolder } = require('../testObservability/helper/constants'); -const HttpsProxyAgent = require('https-proxy-agent'); +const { HttpsProxyAgent = require('https-proxy-agent') } = require('https-proxy-agent'); const { v4: uuidv4 } = require('uuid'); const axios = require('axios'), logger = require('./logger').winstonLogger, diff --git a/bin/helpers/buildArtifacts.js b/bin/helpers/buildArtifacts.js index 30986a60..4070ef8b 100644 --- a/bin/helpers/buildArtifacts.js +++ b/bin/helpers/buildArtifacts.js @@ -9,7 +9,7 @@ const logger = require('./logger').winstonLogger, config = require("./config"); const { default: axios } = require('axios'); -const HttpsProxyAgent = require('https-proxy-agent'); +const { HttpsProxyAgent = require('https-proxy-agent') } = require('https-proxy-agent'); const FormData = require('form-data'); const decompress = require('decompress'); const unzipper = require("unzipper"); diff --git a/bin/helpers/fileHelpers.js b/bin/helpers/fileHelpers.js index cdd73932..e993c667 100644 --- a/bin/helpers/fileHelpers.js +++ b/bin/helpers/fileHelpers.js @@ -27,12 +27,15 @@ exports.fileExists = function (filePath, cb) { exports.deleteZip = () => { try { + if (!fs.existsSync(config.fileName)) { + return 0; + } fs.unlinkSync(config.fileName); logger.info(Constants.userMessages.ZIP_DELETED); return 0; } catch (err) { logger.info(Constants.userMessages.ZIP_DELETE_FAILED); - return 1; + throw err; } }; diff --git a/bin/helpers/helper.js b/bin/helpers/helper.js index e7c32f49..7eedabbd 100644 --- a/bin/helpers/helper.js +++ b/bin/helpers/helper.js @@ -18,7 +18,7 @@ const pGitconfig = promisify(gitconfig); const { readCypressConfigFile } = require('./readCypressConfigUtil'); const { MAX_GIT_META_DATA_SIZE_IN_BYTES, GIT_META_DATA_TRUNCATED } = require('./constants') const CrashReporter = require('../testObservability/crashReporter'); -const HttpsProxyAgent = require('https-proxy-agent'); +const { HttpsProxyAgent = require('https-proxy-agent') } = require('https-proxy-agent'); const { TEST_REPORTING_ANALYTICS } = require("../testObservability/helper/constants"); exports.debug = (text, shouldReport = false, throwable = null) => { diff --git a/bin/testObservability/crashReporter/index.js b/bin/testObservability/crashReporter/index.js index 15022ce9..1839c168 100644 --- a/bin/testObservability/crashReporter/index.js +++ b/bin/testObservability/crashReporter/index.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const axios = require('axios'); const https = require('https'); -const HttpsProxyAgent = require('https-proxy-agent'); +const { HttpsProxyAgent = require('https-proxy-agent') } = require('https-proxy-agent'); const logger = require("../../helpers/logger").winstonLogger; const utils = require('../../helpers/utils'); diff --git a/bin/testObservability/helper/helper.js b/bin/testObservability/helper/helper.js index 71375ec9..de41790c 100644 --- a/bin/testObservability/helper/helper.js +++ b/bin/testObservability/helper/helper.js @@ -9,7 +9,7 @@ const { spawn, execSync } = require('child_process'); const glob = require('glob'); const util = require('util'); const axios = require('axios'); -const HttpsProxyAgent = require('https-proxy-agent'); +const { HttpsProxyAgent = require('https-proxy-agent') } = require('https-proxy-agent'); const { runOptions } = require('../../helpers/runnerArgs') diff --git a/package.json b/package.json index 7d68c2b1..47a6e60f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserstack-cypress-cli", - "version": "1.35.0", + "version": "1.36.0", "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.", "main": "index.js", "scripts": { @@ -17,6 +17,7 @@ "axios": "^1.7.7", "axios-retry": "^3.5.0", "browserstack-local": "1.5.4", + "https-proxy-agent": "^5.0.1", "chalk": "4.1.2", "cli-progress": "^3.10.0", "decompress": "4.2.1",