browserstack-cypress-cli 1.8.0 → 1.8.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.
@@ -158,6 +158,12 @@ exports.setDefaults = (bsConfig, args) => {
158
158
  if (bsConfig.run_settings && this.isUndefined(bsConfig.run_settings.npm_dependencies)) {
159
159
  bsConfig.run_settings.npm_dependencies = {}
160
160
  }
161
+
162
+ // setting connection_settings to {} if not present
163
+ if (this.isUndefined(bsConfig.connection_settings)) {
164
+ bsConfig.connection_settings = {};
165
+ }
166
+
161
167
  }
162
168
 
163
169
  exports.setUsername = (bsConfig, args) => {
@@ -264,7 +270,7 @@ exports.isParallelValid = (value) => {
264
270
  }
265
271
 
266
272
  exports.getUserAgent = () => {
267
- return `BStack-Cypress-CLI/1.8.0 (${os.arch()}/${os.platform()}/${os.release()})`;
273
+ return `BStack-Cypress-CLI/1.8.1 (${os.arch()}/${os.platform()}/${os.release()})`;
268
274
  };
269
275
 
270
276
  exports.isAbsolute = (configPath) => {
@@ -329,7 +335,6 @@ exports.getLocalFlag = (connectionSettings) => {
329
335
  };
330
336
 
331
337
  exports.setLocal = (bsConfig, args) => {
332
- let localInferred = !(this.searchForOption('--local-mode'));
333
338
  if (!this.isUndefined(args.local)) {
334
339
  let local = false;
335
340
  if (String(args.local).toLowerCase() === 'true') {
@@ -345,12 +350,19 @@ exports.setLocal = (bsConfig, args) => {
345
350
  logger.info(
346
351
  'Reading local setting from the environment variable BROWSERSTACK_LOCAL'
347
352
  );
353
+ } else if (!this.isUndefined(bsConfig['connection_settings']['local'])) {
354
+ let local = false;
355
+ if (String(bsConfig['connection_settings']['local']).toLowerCase() === 'true') {
356
+ local = true;
357
+ }
358
+ bsConfig['connection_settings']['local'] = local;
348
359
  } else if (
349
360
  this.isUndefined(bsConfig['connection_settings']['local']) &&
350
- ( !this.isUndefined(args.localMode) || !this.isUndefined(bsConfig['connection_settings']['local_mode']) )
361
+ (!this.isUndefined(args.localMode) ||
362
+ !this.isUndefined(bsConfig['connection_settings']['local_mode']))
351
363
  ) {
352
364
  bsConfig['connection_settings']['local'] = true;
353
- bsConfig.connection_settings.local_inferred = localInferred;
365
+ bsConfig.connection_settings.local_inferred = true;
354
366
  }
355
367
  };
356
368
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -676,7 +676,7 @@ describe('utils', () => {
676
676
  delete process.env.BROWSERSTACK_LOCAL;
677
677
  });
678
678
 
679
- it('bsconfig connection_settings local_inferred as true if serachforOption returns false with args local-mode true', () => {
679
+ it('bsconfig connection_settings local_inferred as true if args local-mode true', () => {
680
680
  let bsConfig = {
681
681
  connection_settings: {
682
682
  }
@@ -684,8 +684,6 @@ describe('utils', () => {
684
684
  let args = {
685
685
  localMode: "always-on"
686
686
  };
687
- let searchForOptionStub = sinon.stub(utils,"searchForOption");
688
- searchForOptionStub.returns(false);
689
687
  utils.setLocal(bsConfig,args);
690
688
  expect(bsConfig.connection_settings.local_inferred).to.be.eq(true);
691
689
  });
@@ -726,14 +724,13 @@ describe('utils', () => {
726
724
  expect(bsConfig.connection_settings.local).to.be.eq(false);
727
725
  });
728
726
 
729
- it('should change local to true in bsConfig if process.env.BROWSERSTACK_LOCAL is set to true', () => {
727
+ it('should change local to true in bsConfig if args.local is set to true', () => {
730
728
  let bsConfig = {
731
729
  connection_settings: {
732
730
  local: false,
733
731
  },
734
732
  };
735
- let args = {};
736
- process.env.BROWSERSTACK_LOCAL = true;
733
+ let args = { local: true };
737
734
  utils.setLocal(bsConfig,args);
738
735
  expect(bsConfig.connection_settings.local).to.be.eq(true);
739
736
  });
@@ -748,6 +745,19 @@ describe('utils', () => {
748
745
  utils.setLocal(bsConfig,args);
749
746
  expect(bsConfig.connection_settings.local).to.be.eq(true);
750
747
  });
748
+
749
+ it('should set local to true in bsConfig if local is passed as string in bsConfig', () => {
750
+ let bsConfig = {
751
+ connection_settings: {
752
+ local: "true"
753
+ },
754
+ };
755
+ let args = {
756
+ };
757
+ utils.setLocal(bsConfig, args);
758
+ expect(bsConfig.connection_settings.local).to.be.eq(true);
759
+ });
760
+
751
761
  });
752
762
 
753
763
  describe('setLocalMode', () => {
@@ -1428,6 +1438,23 @@ describe('utils', () => {
1428
1438
  expect(utils.isUndefined(bsConfig.auth)).to.be.true;
1429
1439
  expect(utils.isUndefined(bsConfig.run_settings.npm_dependencies)).to.be.false;
1430
1440
  });
1441
+
1442
+ it ('should set connection_settings if bsConfig.connection_settings is undefined' , () => {
1443
+ let bsConfig = { run_settings: {} };
1444
+ utils.setDefaults(bsConfig, {});
1445
+ expect(utils.isUndefined(bsConfig.connection_settings)).to.be.false;
1446
+ });
1447
+
1448
+ it('should not set connection_settings if bsConfig.connection_settings is defined ', () => {
1449
+ let bsConfig = {
1450
+ run_settings: {},
1451
+ connection_settings: {
1452
+ local: "false"
1453
+ }
1454
+ };
1455
+ utils.setDefaults(bsConfig, {});
1456
+ expect(bsConfig.connection_settings).to.deep.equal({local: "false"});
1457
+ });
1431
1458
  });
1432
1459
 
1433
1460
  describe('getNumberOfSpecFiles', () => {