browserstack-cypress-cli 1.13.0 → 1.13.1

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.
@@ -231,6 +231,10 @@ const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm
231
231
 
232
232
  const AUTH_REGEX = /"auth" *: *{[\s\S]*?}/g
233
233
 
234
+ const CLI_ARGS_REGEX = /(?<=("u"|"username"|"k"|"key") *: *)"[^,}]*/g
235
+
236
+ const RAW_ARGS_REGEX = /(?<=("-u"|"-username"|"-k"|"-key") *, *)"[^,\]]*/g
237
+
234
238
  const ERROR_EXIT_CODE = 1;
235
239
 
236
240
  const BUILD_FAILED_EXIT_CODE = 3;
@@ -260,7 +264,10 @@ module.exports = Object.freeze({
260
264
  LATEST_VERSION_SYNTAX_REGEX,
261
265
  ERROR_EXIT_CODE,
262
266
  AUTH_REGEX,
267
+ CLI_ARGS_REGEX,
268
+ RAW_ARGS_REGEX,
263
269
  REDACTED_AUTH,
270
+ REDACTED,
264
271
  BUILD_FAILED_EXIT_CODE,
265
272
  SPEC_TIMEOUT_LIMIT
266
273
  });
@@ -7,7 +7,8 @@
7
7
  Constants = require('./constants'),
8
8
  process = require('process'),
9
9
  utils = require('./utils'),
10
- { spawn } = require('child_process');
10
+ { spawn } = require('child_process'),
11
+ util = require('util');
11
12
 
12
13
  let nodeProcess;
13
14
 
@@ -54,16 +55,18 @@ const packageInstall = (packageDir) => {
54
55
  return new Promise(function (resolve, reject) {
55
56
  const nodeProcessCloseCallback = (code) => {
56
57
  if(code == 0) {
58
+ logger.info(`Packages were installed locally successfully.`);
57
59
  resolve('Packages were installed successfully.');
58
60
  } else {
59
- reject('Packages were not installed successfully.');
61
+ logger.error(`Some error occurred while installing packages. Error code ${code}`);
62
+ reject('Packages were not installed successfully. Error code ${code}');
60
63
  }
61
64
  };
62
65
  const nodeProcessErrorCallback = (error) => {
63
- logger.error(`Some error occurred while installing packages: ${error}`);
64
- reject(`Packages were not installed successfully.`);
66
+ logger.error(`Some error occurred while installing packages: ${util.inspect(error)}`);
67
+ reject(`Packages were not installed successfully. Error Description ${util.inspect(error)}`);
65
68
  };
66
- nodeProcess = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['install'], {cwd: packageDir});
69
+ nodeProcess = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['install', '--loglevel', 'verbose', '>', '../npm_install_debug.log', '2>&1'], {cwd: packageDir, shell: true});
67
70
  nodeProcess.on('close', nodeProcessCloseCallback);
68
71
  nodeProcess.on('error', nodeProcessErrorCallback);
69
72
  });
@@ -9,7 +9,7 @@ const config = require('./config'),
9
9
  fileLogger = require('./logger').fileLogger,
10
10
  utils = require('./utils');
11
11
 
12
- const { AUTH_REGEX, REDACTED_AUTH } = require("./constants");
12
+ const { AUTH_REGEX, REDACTED_AUTH, REDACTED, CLI_ARGS_REGEX, RAW_ARGS_REGEX } = require("./constants");
13
13
 
14
14
  function get_version(package_name) {
15
15
  try {
@@ -172,6 +172,10 @@ function isUsageReportingEnabled() {
172
172
  return process.env.DISABLE_USAGE_REPORTING;
173
173
  }
174
174
 
175
+ function redactKeys(str, regex, redact) {
176
+ return str.replace(regex, redact);
177
+ }
178
+
175
179
  function send(args) {
176
180
  if (isUsageReportingEnabled() === "true") return;
177
181
 
@@ -185,10 +189,12 @@ function send(args) {
185
189
  runSettings = bsConfig.run_settings;
186
190
  data.cypress_version = bsConfig.run_settings.cypress_version;
187
191
  }
188
-
189
- sanitizedbsConfig = `${(typeof bsConfig === 'string') ? bsConfig :
190
- JSON.stringify(bsConfig)}`.replace(AUTH_REGEX, REDACTED_AUTH);
191
-
192
+
193
+ sanitizedbsConfig = redactKeys(`${(typeof bsConfig === 'string') ? bsConfig :
194
+ JSON.stringify(bsConfig)}`, AUTH_REGEX, REDACTED_AUTH);
195
+ args.cli_args = args.cli_args && redactKeys(JSON.stringify(args.cli_args), CLI_ARGS_REGEX, REDACTED);
196
+ args.raw_args = args.raw_args && redactKeys(JSON.stringify(args.raw_args), RAW_ARGS_REGEX, REDACTED);
197
+
192
198
  delete args.bstack_config;
193
199
 
194
200
  let zipUploadDetails = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {