Skip to content

Commit 6b78360

Browse files
committed
use runner behind proxy
1 parent 1e6394d commit 6b78360

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Add the following in `browserstack.json`
142142
```json
143143
...
144144
"proxy": {
145-
"host": "localhost",
145+
"hostname": "localhost",
146146
"port": 3128,
147147
"username": "foo",
148148
"password": "bar"

bin/cli.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ var Log = require('../lib/logger'),
1414
utils = require('../lib/utils'),
1515
Server = require('../lib/server').Server,
1616
Tunnel = require('../lib/local').Tunnel,
17+
tunnel = require('tunnel'),
18+
http = require('http'),
1719
ConfigParser = require('../lib/configParser').ConfigParser,
1820
serverPort = 8888,
1921
timeout,
2022
activityTimeout,
2123
workers = {},
2224
workerKeys = {},
2325
logLevel,
26+
tunnelingAgent,
2427
tunnel;
2528

2629
function cleanUp(signal) {
@@ -214,6 +217,17 @@ var statusPoller = {
214217
};
215218

216219
function runTests() {
220+
if (config.proxy) {
221+
console.log(config.proxy);
222+
tunnelingAgent = tunnel.httpOverHttp({
223+
proxy: config.proxy;
224+
});
225+
var oldhttpreq = http.request;
226+
http.request = function (options, callback) {
227+
options.agent = tunnelingAgent;
228+
return oldhttpreq.call(null, options, callback);
229+
};
230+
}
217231
if (config.browsers && config.browsers.length > 0) {
218232
ConfigParser.parse(client, config.browsers, function(browsers){
219233
launchServer();

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
},
1010
"dependencies": {
1111
"browserstack": "1.0.1",
12-
"chalk": "0.4.0"
12+
"chalk": "0.4.0",
13+
"tunnel": "0.0.3"
1314
},
1415
"licenses": [
1516
{

0 commit comments

Comments
 (0)