Skip to content

Commit 0eaf577

Browse files
committed
Merge pull request #7 from browserstack/args
Args
2 parents f2c2924 + 9b5ca9f commit 0eaf577

File tree

3 files changed

+37
-47
lines changed

3 files changed

+37
-47
lines changed

lib/Local.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,83 +81,83 @@ function Local(){
8181
var value = options[key];
8282

8383
switch(key){
84-
case 'key':
84+
case '-key':
8585
this.key = value;
8686
break;
8787

88-
case 'v':
88+
case '-v':
8989
if(value)
9090
this.verboseFlag = '-vvv';
9191
break;
9292

93-
case 'force':
93+
case '-force':
9494
if(value)
9595
this.forceFlag = '-force';
9696
break;
9797

98-
case 'only':
98+
case '-only':
9999
if(value)
100100
this.onlyFlag = '-only';
101101
break;
102102

103-
case 'onlyAutomate':
103+
case '-onlyAutomate':
104104
if(value)
105105
this.onlyAutomateFlag = '-onlyAutomate';
106106
break;
107107

108-
case 'forcelocal':
108+
case '-forcelocal':
109109
if(value)
110110
this.forceLocalFlag = '-forcelocal';
111111
break;
112112

113-
case 'localIdentifier':
113+
case '-localIdentifier':
114114
if(value)
115115
this.localIdentifierFlag = '-localIdentifier ' + value;
116116
break;
117117

118-
case 'f':
118+
case '-f':
119119
if(value){
120120
this.folderFlag = '-f';
121121
this.folderPath = value;
122122
}
123123
break;
124124

125-
case 'proxyHost':
125+
case '-proxyHost':
126126
if(value)
127127
this.proxyHost = '-proxyHost ' + value;
128128
break;
129129

130-
case 'proxyPort':
130+
case '-proxyPort':
131131
if(value)
132132
this.proxyPort = '-proxyPort ' + value;
133133
break;
134134

135-
case 'proxyUser':
135+
case '-proxyUser':
136136
if(value)
137137
this.proxyUser = '-proxyUser ' + value;
138138
break;
139139

140-
case 'proxyPass':
140+
case '-proxyPass':
141141
if(value)
142142
this.proxyPass = '-proxyPass ' + value;
143143
break;
144144

145-
case 'forceproxy':
145+
case '-forceproxy':
146146
if(value)
147147
this.forceProxyFlag = '-forceproxy';
148148
break;
149149

150-
case 'hosts':
150+
case '-hosts':
151151
if(value)
152152
this.hosts = value;
153153
break;
154154

155-
case 'logfile':
155+
case '-logfile':
156156
if(value)
157157
this.logfile = value;
158158
break;
159159

160-
case 'binarypath':
160+
case '-binarypath':
161161
if(value)
162162
this.binaryPath = value;
163163
break;

node-example.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,14 @@ var capabilities = {
1313
}
1414

1515
var options = {
16-
key: process.env.BROWSERSTACK_ACCESS_KEY,
16+
'-key': process.env.BROWSERSTACK_ACCESS_KEY,
1717
//hosts: [{
1818
// name: 'localhost',
1919
// port: 8080,
2020
// sslFlag: 0
2121
//}],
22-
//f: __dirname,
23-
//binaryPath: '/var/BrowserStackLocal',
24-
//logfile: '/var/log/local.log',
25-
//localIdentifier: identifier,
26-
//verbose: true,
27-
//proxyUser: '',
28-
//proxyPass: '',
29-
//proxyPort: 80,
30-
//proxyHost: 'host',
31-
//force: true,
32-
//forcelocal: true,
33-
//onlyAutomate: true
22+
//'-f': __dirname,
23+
//'-binaryPath': '/var/BrowserStackLocal'
3424
};
3525

3626
// try {

test/local.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('Local', function () {
1212

1313
it('should have pid when running', function (done) {
1414
this.timeout(600000);
15-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY }, function(){
15+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY }, function(){
1616
expect(bsLocal.tunnel.pid).to.not.equal(0);
1717
done();
1818
});
@@ -21,19 +21,19 @@ describe('Local', function () {
2121
it('should return is running properly', function (done) {
2222
this.timeout(60000);
2323
expect(bsLocal.isRunning()).to.not.equal(true);
24-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY }, function(){
24+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY }, function(){
2525
expect(bsLocal.isRunning()).to.equal(true);
2626
done();
2727
});
2828
});
2929

3030
it('should throw error on running multiple binary', function (done) {
3131
this.timeout(60000);
32-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY }, function(){
32+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY }, function(){
3333
bsLocal_2 = new browserstack.Local();
3434
var tempLogPath = path.join(process.cwd(), 'log2.log');
3535
try{
36-
bsLocal_2.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, logfile: tempLogPath }, function(){});
36+
bsLocal_2.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, '-logfile': tempLogPath }, function(){});
3737
}
3838
catch(err){
3939
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,71 +44,71 @@ describe('Local', function () {
4444
});
4545

4646
it('should enable verbose', function (done) {
47-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, v: true }, function(){
47+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-v': true }, function(){
4848
expect(bsLocal.getBinaryArgs().indexOf('-vvv')).to.not.equal(-1);
4949
done();
5050
});
5151
});
5252

5353
it('should set folder testing', function (done) {
54-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, f: '/var/html' }, function(){
54+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-f': '/var/html' }, function(){
5555
expect(bsLocal.getBinaryArgs().indexOf('-f')).to.not.equal(-1);
5656
expect(bsLocal.getBinaryArgs().indexOf('/var/html')).to.not.equal(-1);
5757
done();
5858
});
5959
});
6060

6161
it('should enable force', function (done) {
62-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, force: true }, function(){
62+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-force': true }, function(){
6363
expect(bsLocal.getBinaryArgs().indexOf('-force')).to.not.equal(-1);
6464
done();
6565
});
6666
});
6767

6868
it('should enable only', function (done) {
69-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, only: true }, function(){
69+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-only': true }, function(){
7070
expect(bsLocal.getBinaryArgs().indexOf('-only')).to.not.equal(-1);
7171
done();
7272
});
7373
});
7474

7575
it('should enable onlyAutomate', function (done) {
76-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, onlyAutomate: true }, function(){
76+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-onlyAutomate': true }, function(){
7777
expect(bsLocal.getBinaryArgs().indexOf('-onlyAutomate')).to.not.equal(-1);
7878
done();
7979
});
8080
});
8181

8282
it('should enable forcelocal', function (done) {
83-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, forcelocal: true }, function(){
83+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-forcelocal': true }, function(){
8484
expect(bsLocal.getBinaryArgs().indexOf('-forcelocal')).to.not.equal(-1);
8585
done();
8686
});
8787
});
8888

8989
it('should enable forceproxy', function (done) {
90-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, forceproxy: true }, function(){
90+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-forceproxy': true }, function(){
9191
expect(bsLocal.getBinaryArgs().indexOf('-forceproxy')).to.not.equal(-1);
9292
done();
9393
});
9494
});
9595

9696

9797
it('should set localIdentifier', function (done) {
98-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, localIdentifier: 'abcdef' }, function(){
98+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-localIdentifier': 'abcdef' }, function(){
9999
expect(bsLocal.getBinaryArgs().indexOf('-localIdentifier abcdef')).to.not.equal(-1);
100100
done();
101101
});
102102
});
103103

104104
it('should set proxy', function (done) {
105105
bsLocal.start({
106-
key: process.env.BROWSERSTACK_ACCESS_KEY,
106+
'-key': process.env.BROWSERSTACK_ACCESS_KEY,
107107
onlyCommand: true,
108-
proxyHost: 'localhost',
109-
proxyPort: 8080,
110-
proxyUser: 'user',
111-
proxyPass: 'pass'
108+
'-proxyHost': 'localhost',
109+
'-proxyPort': 8080,
110+
'-proxyUser': 'user',
111+
'-proxyPass': 'pass'
112112
}, function(){
113113
expect(bsLocal.getBinaryArgs().indexOf('-proxyHost localhost')).to.not.equal(-1);
114114
expect(bsLocal.getBinaryArgs().indexOf('-proxyPort 8080')).to.not.equal(-1);
@@ -119,7 +119,7 @@ describe('Local', function () {
119119
});
120120

121121
it('should set hosts', function (done) {
122-
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, hosts: 'localhost,8000,0' }, function(){
122+
bsLocal.start({ '-key': process.env.BROWSERSTACK_ACCESS_KEY, onlyCommand: true, '-hosts': 'localhost,8000,0' }, function(){
123123
expect(bsLocal.getBinaryArgs().indexOf('localhost,8000,0')).to.not.equal(-1);
124124
done();
125125
});

0 commit comments

Comments
 (0)