diff --git a/bin/helpers/utils.js b/bin/helpers/utils.js index c59c9785..b2c3cf8c 100644 --- a/bin/helpers/utils.js +++ b/bin/helpers/utils.js @@ -158,6 +158,12 @@ exports.setDefaults = (bsConfig, args) => { if (bsConfig.run_settings && this.isUndefined(bsConfig.run_settings.npm_dependencies)) { bsConfig.run_settings.npm_dependencies = {} } + + // setting connection_settings to {} if not present + if (this.isUndefined(bsConfig.connection_settings)) { + bsConfig.connection_settings = {}; + } + } exports.setUsername = (bsConfig, args) => { diff --git a/test/unit/bin/helpers/utils.js b/test/unit/bin/helpers/utils.js index 84bb8997..b9c93eb7 100644 --- a/test/unit/bin/helpers/utils.js +++ b/test/unit/bin/helpers/utils.js @@ -1428,6 +1428,23 @@ describe('utils', () => { expect(utils.isUndefined(bsConfig.auth)).to.be.true; expect(utils.isUndefined(bsConfig.run_settings.npm_dependencies)).to.be.false; }); + + it ('should set connection_settings if bsConfig.connection_settings is undefined' , () => { + let bsConfig = { run_settings: {} }; + utils.setDefaults(bsConfig, {}); + expect(utils.isUndefined(bsConfig.connection_settings)).to.be.false; + }); + + it('should not set connection_settings if bsConfig.connection_settings is defined ', () => { + let bsConfig = { + run_settings: {}, + connection_settings: { + local: "false" + } + }; + utils.setDefaults(bsConfig, {}); + expect(bsConfig.connection_settings).to.deep.equal({local: "false"}); + }); }); describe('getNumberOfSpecFiles', () => {