diff --git a/lib/Local.js b/lib/Local.js index eb7c196..ba673f2 100644 --- a/lib/Local.js +++ b/lib/Local.js @@ -81,83 +81,83 @@ function Local(){ var value = options[key]; switch(key){ - case 'key': + case '-key': this.key = value; break; - case 'v': + case '-v': if(value) this.verboseFlag = '-vvv'; break; - case 'force': + case '-force': if(value) this.forceFlag = '-force'; break; - case 'only': + case '-only': if(value) this.onlyFlag = '-only'; break; - case 'onlyAutomate': + case '-onlyAutomate': if(value) this.onlyAutomateFlag = '-onlyAutomate'; break; - case 'forcelocal': + case '-forcelocal': if(value) this.forceLocalFlag = '-forcelocal'; break; - case 'localIdentifier': + case '-localIdentifier': if(value) this.localIdentifierFlag = '-localIdentifier ' + value; break; - case 'f': + case '-f': if(value){ this.folderFlag = '-f'; this.folderPath = value; } break; - case 'proxyHost': + case '-proxyHost': if(value) this.proxyHost = '-proxyHost ' + value; break; - case 'proxyPort': + case '-proxyPort': if(value) this.proxyPort = '-proxyPort ' + value; break; - case 'proxyUser': + case '-proxyUser': if(value) this.proxyUser = '-proxyUser ' + value; break; - case 'proxyPass': + case '-proxyPass': if(value) this.proxyPass = '-proxyPass ' + value; break; - case 'forceproxy': + case '-forceproxy': if(value) this.forceProxyFlag = '-forceproxy'; break; - case 'hosts': + case '-hosts': if(value) this.hosts = value; break; - case 'logfile': + case '-logfile': if(value) this.logfile = value; break; - case 'binarypath': + case '-binarypath': if(value) this.binaryPath = value; break; diff --git a/node-example.js b/node-example.js index 50aa7c1..511959c 100644 --- a/node-example.js +++ b/node-example.js @@ -13,24 +13,14 @@ var capabilities = { } var options = { - key: process.env.BROWSERSTACK_ACCESS_KEY, + '-key': process.env.BROWSERSTACK_ACCESS_KEY, //hosts: [{ // name: 'localhost', // port: 8080, // sslFlag: 0 //}], - //f: __dirname, - //binaryPath: '/var/BrowserStackLocal', - //logfile: '/var/log/local.log', - //localIdentifier: identifier, - //verbose: true, - //proxyUser: '', - //proxyPass: '', - //proxyPort: 80, - //proxyHost: 'host', - //force: true, - //forcelocal: true, - //onlyAutomate: true + //'-f': __dirname, + //'-binaryPath': '/var/BrowserStackLocal' }; // try { diff --git a/test/local.js b/test/local.js index 77755d0..7089fcc 100644 --- a/test/local.js +++ b/test/local.js @@ -12,7 +12,7 @@ describe('Local', function () { it('should have pid when running', function (done) { this.timeout(600000); - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY }, function(){ expect(bsLocal.tunnel.pid).to.not.equal(0); done(); }); @@ -21,7 +21,7 @@ describe('Local', function () { it('should return is running properly', function (done) { this.timeout(60000); expect(bsLocal.isRunning()).to.not.equal(true); - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY }, function(){ expect(bsLocal.isRunning()).to.equal(true); done(); }); @@ -29,11 +29,11 @@ describe('Local', function () { it('should throw error on running multiple binary', function (done) { this.timeout(60000); - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY }, function(){ bsLocal_2 = new browserstack.Local(); var tempLogPath = path.join(process.cwd(), 'log2.log'); try{ - bsLocal_2.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, logfile: tempLogPath }, function(){}); + bsLocal_2.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, '-logfile': tempLogPath }, function(){}); } catch(err){ expect(err.toString().trim()).to.equal('LocalError: *** Error: Either another browserstack local client is running on your machine or some server is listening on port 45691'); @@ -44,14 +44,14 @@ describe('Local', function () { }); it('should enable verbose', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, v: true }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-v': true }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-vvv')).to.not.equal(-1); done(); }); }); it('should set folder testing', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, f: '/var/html' }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-f': '/var/html' }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-f')).to.not.equal(-1); expect(bsLocal.getBinaryArgs().indexOf('/var/html')).to.not.equal(-1); done(); @@ -59,35 +59,35 @@ describe('Local', function () { }); it('should enable force', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, force: true }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-force': true }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-force')).to.not.equal(-1); done(); }); }); it('should enable only', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, only: true }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-only': true }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-only')).to.not.equal(-1); done(); }); }); it('should enable onlyAutomate', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, onlyAutomate: true }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-onlyAutomate': true }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-onlyAutomate')).to.not.equal(-1); done(); }); }); it('should enable forcelocal', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, forcelocal: true }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-forcelocal': true }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-forcelocal')).to.not.equal(-1); done(); }); }); it('should enable forceproxy', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, forceproxy: true }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-forceproxy': true }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-forceproxy')).to.not.equal(-1); done(); }); @@ -95,7 +95,7 @@ describe('Local', function () { it('should set localIdentifier', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, localIdentifier: 'abcdef' }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-localIdentifier': 'abcdef' }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-localIdentifier abcdef')).to.not.equal(-1); done(); }); @@ -103,12 +103,12 @@ describe('Local', function () { it('should set proxy', function (done) { bsLocal.start({ - key: process.env.BROWSERSTACK_ACCESS_KEY, + '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, - proxyHost: 'localhost', - proxyPort: 8080, - proxyUser: 'user', - proxyPass: 'pass' + '-proxyHost': 'localhost', + '-proxyPort': 8080, + '-proxyUser': 'user', + '-proxyPass': 'pass' }, function(){ expect(bsLocal.getBinaryArgs().indexOf('-proxyHost localhost')).to.not.equal(-1); expect(bsLocal.getBinaryArgs().indexOf('-proxyPort 8080')).to.not.equal(-1); @@ -119,7 +119,7 @@ describe('Local', function () { }); it('should set hosts', function (done) { - bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, hosts: 'localhost,8000,0' }, function(){ + bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-hosts': 'localhost,8000,0' }, function(){ expect(bsLocal.getBinaryArgs().indexOf('localhost,8000,0')).to.not.equal(-1); done(); });