browserstack-cypress-cli 1.32.6 → 1.32.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,6 +82,7 @@ exports.getTurboScaleGridDetails = async (bsConfig, args, rawArgs) => {
82
82
  }
83
83
  resolve(responseData);
84
84
  }).catch(error => {
85
+ logger.warn(`Grid with name - ${gridName} not found`);
85
86
  logger.warn(utils.formatRequest(error, null, null));
86
87
  utils.sendUsageReport(bsConfig, args, error, Constants.messageTypes.ERROR, 'get_ats_details_failed', null, rawArgs);
87
88
  resolve({});
@@ -330,8 +330,8 @@ exports.setCypressConfigFilename = (bsConfig, args) => {
330
330
 
331
331
  exports.setCypressTestSuiteType = (bsConfig) => {
332
332
  for (const possibleCypressFileName of Constants.CYPRESS_CONFIG_FILE_NAMES) {
333
- if (bsConfig.run_settings.cypressConfigFilePath &&
334
- typeof(bsConfig.run_settings.cypressConfigFilePath) === 'string' &&
333
+ if (bsConfig.run_settings.cypressConfigFilePath &&
334
+ typeof(bsConfig.run_settings.cypressConfigFilePath) === 'string' &&
335
335
  (path.extname(bsConfig.run_settings.cypressConfigFilePath) == path.extname(possibleCypressFileName) || bsConfig.run_settings.cypressConfigFilePath.endsWith(possibleCypressFileName))) {
336
336
  bsConfig.run_settings.cypressTestSuiteType = Constants.CYPRESS_CONFIG_FILE_MAPPING[possibleCypressFileName].type;
337
337
  break;
@@ -347,11 +347,11 @@ exports.setCypressTestSuiteType = (bsConfig) => {
347
347
 
348
348
  exports.setCypressNpmDependency = (bsConfig) => {
349
349
  const runSettings = bsConfig.run_settings;
350
- if (runSettings.npm_dependencies !== undefined &&
350
+ if (runSettings.npm_dependencies !== undefined &&
351
351
  Object.keys(runSettings.npm_dependencies).length !== 0 &&
352
352
  typeof runSettings.npm_dependencies === 'object') {
353
353
  if (!("cypress" in runSettings.npm_dependencies) && runSettings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) {
354
- logger.warn("Missing cypress not found in npm_dependencies");
354
+ logger.warn("Missing cypress not found in npm_dependencies");
355
355
  if("cypress_version" in runSettings){
356
356
  runSettings.npm_dependencies.cypress = `^${runSettings.cypress_version.toString().split(".")[0]}`;
357
357
  } else if (runSettings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) {
@@ -386,13 +386,13 @@ exports.setGeolocation = (bsConfig, args) => {
386
386
  }
387
387
 
388
388
  exports.isSpecTimeoutArgPassed = () => {
389
- return this.searchForOption('--spec-timeout') || this.searchForOption('-t');
389
+ return this.searchForOption('--spec-timeout') || this.searchForOption('-t');
390
390
  }
391
391
  exports.setSpecTimeout = (bsConfig, args) => {
392
392
  let specTimeout = null;
393
393
  if(this.isSpecTimeoutArgPassed()) {
394
- if(!this.isUndefined(args.specTimeout)) {
395
- specTimeout = args.specTimeout;
394
+ if(!this.isUndefined(args.specTimeout)) {
395
+ specTimeout = args.specTimeout;
396
396
  } else {
397
397
  specTimeout = 'undefined'
398
398
  }
@@ -410,7 +410,7 @@ exports.setTimezone = (bsConfig, args) => {
410
410
  let newTimezone;
411
411
  if(this.isNotUndefined(timezone)) {
412
412
  if(this.isValidTimezone(timezone)){
413
- newTimezone = timezone;
413
+ newTimezone = timezone;
414
414
  } else {
415
415
  logger.error(`Invalid timezone = ${timezone}`);
416
416
  syncCliLogger.info(chalk.red(Constants.userMessages.INVALID_TIMEZONE));
@@ -443,11 +443,11 @@ exports.setProjectId = (bsConfig, args, cypressConfigFile) => {
443
443
  } else if(!this.isUndefined(process.env.CYPRESS_PROJECT_ID)) {
444
444
  return process.env.CYPRESS_PROJECT_ID;
445
445
  } else if(!this.isUndefined(bsConfig.run_settings["projectId"])) {
446
- return bsConfig.run_settings["projectId"];
446
+ return bsConfig.run_settings["projectId"];
447
447
  } else {
448
448
  // ignore reading cypressconfig if enforce_settings is passed
449
449
  if (this.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) && !this.isUndefined(cypressConfigFile) && !this.isUndefined(cypressConfigFile["projectId"])) {
450
- return cypressConfigFile["projectId"];
450
+ return cypressConfigFile["projectId"];
451
451
  }
452
452
  }
453
453
  }
@@ -497,7 +497,7 @@ exports.setUserSpecs = (bsConfig, args) => {
497
497
  bsConfig.run_settings.specs = process.env.BROWSERSTACK_RERUN_TESTS;
498
498
  return;
499
499
  }
500
-
500
+
501
501
  let bsConfigSpecs = bsConfig.run_settings.specs;
502
502
 
503
503
  if (!this.isUndefined(args.specs)) {
@@ -1167,7 +1167,7 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession
1167
1167
  let files
1168
1168
  if (globSearchPattern) {
1169
1169
  let fileMatchedWithBstackSpecPattern = glob.sync(globSearchPattern, {
1170
- cwd: bsConfig.run_settings.cypressProjectDir, matchBase: true, ignore: ignoreFiles
1170
+ cwd: bsConfig.run_settings.cypressProjectDir, matchBase: true, ignore: ignoreFiles
1171
1171
  });
1172
1172
  fileMatchedWithBstackSpecPattern = fileMatchedWithBstackSpecPattern.map((file) => path.resolve(bsConfig.run_settings.cypressProjectDir, file))
1173
1173
 
@@ -1184,12 +1184,14 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession
1184
1184
  const directory = path.join(path.dirname(configFilePath), '/');
1185
1185
  // remove unwanted path prefix for turboscale
1186
1186
  files = files.map((x) => { return path.join('', x.split(directory)[1]) })
1187
- // setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI
1188
- bsConfig.run_settings.specs = files;
1189
1187
  } else {
1190
1188
  files = files.map((x) => { return path.join(testFolderPath, x.split(testFolderPath)[1]) })
1191
- bsConfig.run_settings.specs = files;
1192
1189
  }
1190
+
1191
+ // sanitize spec list as CLI might be running on windows
1192
+ files = files.map((x) => { return x.replaceAll("\\", "/") })
1193
+ // setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI
1194
+ bsConfig.run_settings.specs = files;
1193
1195
  }
1194
1196
  return files;
1195
1197
  };
@@ -1453,12 +1455,12 @@ exports.setEnforceSettingsConfig = (bsConfig, args) => {
1453
1455
  /**
1454
1456
  * Splits a string by a specified splitChar.
1455
1457
  * If leftLimiter and rightLimiter are specified then string won't be splitted if the splitChar is within the range
1456
- *
1458
+ *
1457
1459
  * @param {String} str - the string that needs to be splitted
1458
1460
  * @param {String} splitChar - the split string/char from which the string will be splited
1459
1461
  * @param {String} [leftLimiter] - the starting string/char of the range
1460
1462
  * @param {String} [rightLimiter] - the ending string/char of the range
1461
- *
1463
+ *
1462
1464
  * @example Example usage of splitStringByCharButIgnoreIfWithinARange.
1463
1465
  * // returns ["folder/A/B", "folder/{C,D}/E"]
1464
1466
  * utils.splitStringByCharButIgnoreIfWithinARange("folder/A/B,folder/{C,D}/E", ",", "{", "}");
@@ -1567,7 +1569,7 @@ exports.formatRequest = (err, resp, body) => {
1567
1569
 
1568
1570
  exports.setDebugMode = (args) => {
1569
1571
  if(args.cliDebug || String(process.env.DEBUG).toLowerCase() === 'true'){
1570
- args.cliDebug ?
1572
+ args.cliDebug ?
1571
1573
  logger.info("CLI is running with the --cli-debug argument. Running CLI in the debug mode...") :
1572
1574
  logger.info("DEBUG environment variable set to 'true'. Running CLI in the debug mode...") ;
1573
1575
  transports.loggerConsole.level = 'debug';
@@ -1580,7 +1582,7 @@ exports.setDebugMode = (args) => {
1580
1582
 
1581
1583
  exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs, buildReportData = null) => {
1582
1584
  let that = this;
1583
-
1585
+
1584
1586
  let url = config.buildStopUrl + buildId;
1585
1587
  let options = {
1586
1588
  url: url,
@@ -1607,10 +1609,10 @@ exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs, buildRe
1607
1609
  let messageType = null;
1608
1610
  let errorCode = null;
1609
1611
  let build = null;
1610
-
1612
+
1611
1613
  try {
1612
1614
  const response = await axios.post(options.url, {}, axiosConfig);
1613
-
1615
+
1614
1616
  build = response.data;
1615
1617
  if (response.status == 299) {
1616
1618
  messageType = Constants.messageTypes.INFO;
@@ -1780,7 +1782,7 @@ exports.getMajorVersion = (version) => {
1780
1782
  } catch(error) {
1781
1783
  logger.debug(`Some Error occurred while fetching major version of ${version}. Returning null. Error Details: ${error}`)
1782
1784
  return null;
1783
- }
1785
+ }
1784
1786
  }
1785
1787
 
1786
1788
  const base64UrlDecode = (str) => {
package/log/usage.log ADDED
@@ -0,0 +1,4 @@
1
+ {"level":"info","message":"Sending {\"event_type\":\"cypress_cli_stats\",\"data\":{\"bstack_json\":\"null\",\"run_settings\":\"\",\"os\":\"darwin\",\"os_version\":\"23.6.0\",\"bstack_json_found_in_pwd\":false,\"cypress_config_file_found_in_pwd\":null,\"cli_version\":\"1.32.5\",\"cli_path\":\"/Users/karannagpal/.nvm/versions/node/v16.10.0/lib/node_modules\",\"npm_version\":\"7.24.0\",\"local_cypress_version\":null,\"ci_environment\":null,\"event_timestamp\":\"3/12/2025, 3:47:25 PM\",\"data\":null,\"raw_args\":\"[\\\"run\\\",\\\"--sync\\\",\\\"--config-file\\\",\\\"./browserstack-prod.json\\\",\\\"--cypress-config-file\\\",\\\"./cypress.config.js\\\"]\",\"cli_args\":\"{\\\"_\\\":[\\\"run\\\"],\\\"sync\\\":true,\\\"config-file\\\":\\\"./browserstack-prod.json\\\",\\\"cf\\\":\\\"./browserstack-prod.json\\\",\\\"configFile\\\":\\\"./browserstack-prod.json\\\",\\\"cypress-config-file\\\":\\\"./cypress.config.js\\\",\\\"ccf\\\":\\\"./cypress.config.js\\\",\\\"cypressConfigFile\\\":\\\"./cypress.config.js\\\",\\\"cli-debug\\\":false,\\\"cliDebug\\\":false,\\\"disable-npm-warning\\\":false,\\\"disableNpmWarning\\\":false,\\\"async\\\":false,\\\"force-upload\\\":false,\\\"forceUpload\\\":false,\\\"headed\\\":false,\\\"no-wrap\\\":false,\\\"noWrap\\\":false,\\\"$0\\\":\\\"browserstack-cypress\\\"}\",\"message_type\":\"error\",\"error_code\":\"bstack_json_invalid_unknown\"}} to https://eds.browserstack.com:443/send_event_cy_internal","timestamp":"2025-03-12T10:17:25.299Z"}
2
+ {"level":"info","message":"{\"statusText\":\"OK\",\"statusCode\":200,\"body\":\"Bravo\"}","timestamp":"2025-03-12T10:17:26.295Z"}
3
+ {"level":"info","message":"Sending {\"event_type\":\"cypress_cli_stats\",\"data\":{\"bstack_json\":\"null\",\"run_settings\":\"\",\"os\":\"darwin\",\"os_version\":\"23.6.0\",\"bstack_json_found_in_pwd\":false,\"cypress_config_file_found_in_pwd\":null,\"cli_version\":\"1.32.5\",\"cli_path\":\"/Users/karannagpal/.nvm/versions/node/v16.10.0/lib/node_modules\",\"npm_version\":\"7.24.0\",\"local_cypress_version\":null,\"ci_environment\":null,\"event_timestamp\":\"3/12/2025, 6:46:06 PM\",\"data\":null,\"raw_args\":\"[\\\"run\\\",\\\"--sync\\\",\\\"--config-file\\\",\\\"./browserstack-prod.json\\\",\\\"--cypress-config-file\\\",\\\"./cypress.config.js\\\"]\",\"cli_args\":\"{\\\"_\\\":[\\\"run\\\"],\\\"sync\\\":true,\\\"config-file\\\":\\\"./browserstack-prod.json\\\",\\\"cf\\\":\\\"./browserstack-prod.json\\\",\\\"configFile\\\":\\\"./browserstack-prod.json\\\",\\\"cypress-config-file\\\":\\\"./cypress.config.js\\\",\\\"ccf\\\":\\\"./cypress.config.js\\\",\\\"cypressConfigFile\\\":\\\"./cypress.config.js\\\",\\\"cli-debug\\\":false,\\\"cliDebug\\\":false,\\\"disable-npm-warning\\\":false,\\\"disableNpmWarning\\\":false,\\\"async\\\":false,\\\"force-upload\\\":false,\\\"forceUpload\\\":false,\\\"headed\\\":false,\\\"no-wrap\\\":false,\\\"noWrap\\\":false,\\\"$0\\\":\\\"browserstack-cypress\\\"}\",\"message_type\":\"error\",\"error_code\":\"bstack_json_invalid_unknown\"}} to https://eds.browserstack.com:443/send_event_cy_internal","timestamp":"2025-03-12T13:16:06.225Z"}
4
+ {"level":"info","message":"{\"statusText\":\"OK\",\"statusCode\":200,\"body\":\"Bravo\"}","timestamp":"2025-03-12T13:16:07.276Z"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.32.6",
3
+ "version": "1.32.8",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {