Skip to content

Commit 242b8f4

Browse files
committed
Merge pull request #12 from browserstack/multiple_tunnel
Multiple tunnel
2 parents d56410e + 931f171 commit 242b8f4

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

bin/runner.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ function launchBrowser(browser) {
8787
browser.build = config.build;
8888
}
8989

90+
if(config.tunnelIdentifier) {
91+
browser["tunnel_identifier"] = config.tunnelIdentifier;
92+
}
93+
9094
client.createWorker(browser, function (err, worker) {
9195
if (err || typeof worker !== 'object') {
9296
utils.alertBrowserStack("Failed to launch worker",
@@ -135,7 +139,7 @@ function launchBrowser(browser) {
135139
}
136140

137141
if (config.browsers && config.browsers.length > 0) {
138-
tunnel = new Tunnel(config.key, serverPort, function () {
142+
tunnel = new Tunnel(config.key, serverPort, config.tunnelIdentifier, function () {
139143
config.browsers.forEach(function(browser) {
140144
if (browser.browser_version === "latest") {
141145
console.log("[%s] Finding version.", utils.browserString(browser));

lib/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ if (!fs.existsSync(config.test_path)){
6161
process.exit(1);
6262
}
6363

64+
config.tunnelIdentifier = process.env.TUNNEL_ID || process.env.TRAVIS_BUILD_ID;
65+
6466
for (key in config) {
6567
if (config.hasOwnProperty(key)) {
6668
exports[key] = config[key];

lib/tunnel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var exec = require('child_process').exec,
44
tunnelJar = '/tmp/BrowserStackTunnel.jar',
55
utils = require('./utils');
66

7-
var Tunnel = function Tunnel (key, port, callback, err) {
7+
var Tunnel = function Tunnel (key, port, tunnelIdentifier, callback, err) {
88
var that = {};
99

1010
function tunnelLauncher () {
@@ -13,7 +13,7 @@ var Tunnel = function Tunnel (key, port, callback, err) {
1313
tunnelCommand += 'localhost' + ',';
1414
tunnelCommand += port.toString() + ',';
1515
tunnelCommand += '0';
16-
tunnelCommand += ' -force -onlyAutomate';
16+
tunnelCommand += (typeof tunnelIdentifier === 'undefined')? ' -force -onlyAutomate' : ' -tunnelIdentifier ' + tunnelIdentifier;
1717

1818
if (typeof callback !== 'function') {
1919
callback = function () {};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "git://github.com/browserstack/browserstack-runner.git"
99
},
1010
"dependencies": {
11-
"browserstack": "git://github.com/browserstack/node-browserstack.git"
11+
"browserstack": "1.0.1"
1212
},
1313
"bin": {
1414
"browserstack-runner": "bin/cli.js"

0 commit comments

Comments
 (0)