Skip to content

Commit 4b7a30e

Browse files
committed
importing piyush code for multi path
1 parent f797cd5 commit 4b7a30e

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

bin/runner.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,10 @@ console.log("Launching server on port:", serverPort);
6262
var server = new Server(client, workers);
6363
server.listen(parseInt(serverPort, 10));
6464

65-
function launchBrowser(browser) {
65+
function launchBrowser(browser, url) {
6666
var browserString = utils.browserString(browser);
6767
console.log("[%s] Launching", browserString);
6868

69-
var url = 'http://localhost:' + serverPort.toString() + '/';
70-
url += config.test_path;
71-
7269
var key = utils.uuid();
7370

7471
if (url.indexOf('?') > 0) {
@@ -152,7 +149,15 @@ if (config.browsers && config.browsers.length > 0) {
152149

153150
// So that all latest logs come in together
154151
setTimeout(function () {
155-
launchBrowser(browser);
152+
if(Object.prototype.toString.call(config.test_path) === '[object Array]'){
153+
config.test_path.forEach(function(path){
154+
var url = 'http://localhost:' + serverPort.toString() + '/' + path;
155+
launchBrowser(browser,url);
156+
});
157+
} else {
158+
var url = 'http://localhost:' + serverPort.toString() + '/' + config.test_path;
159+
launchBrowser(browser,url);
160+
}
156161
}, 100);
157162
});
158163
} else {

lib/config.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,28 @@ if (commit_id) {
5656
}
5757
});
5858

59-
// Convert absoulte path into relative paths.
60-
if (config.test_path.indexOf(pwd) === 0) {
61-
config.test_path = config.test_path.slice(pwd.length + 1);
62-
}
63-
64-
if (!fs.existsSync(config.test_path)){
65-
console.error('Test path is invalid.');
66-
process.exit(1);
59+
var formatPath = function(path) {
60+
if (path.indexOf(pwd) === 0) {
61+
path= path.slice(pwd.length + 1);
62+
}
63+
if (!fs.existsSync(path)){
64+
console.error('Test path: '+ path + ' is invalid.');
65+
process.exit(1);
66+
}
67+
return path;
6768
}
6869

6970
config.tunnelIdentifier = process.env.TUNNEL_ID || process.env.TRAVIS_JOB_ID || process.env.TRAVIS_BUILD_ID;
7071

72+
if(Object.prototype.toString.call(config.test_path) === '[object Array]') {
73+
config.test_path.forEach(function(path){
74+
path = formatPath(path);
75+
});
76+
} else {
77+
//Backward Compatibility, if test_path is not array of path
78+
config.test_path = formatPath(config.test_path);
79+
}
80+
7181
for (key in config) {
7282
if (config.hasOwnProperty(key)) {
7383
exports[key] = config[key];

lib/tunnel.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var Tunnel = function Tunnel (key, port, tunnelIdentifier, callback, err) {
2525
console.log("Launching tunnel");
2626
var subProcess = exec(tunnelCommand, function (error, stdout, stderr) {
2727
console.error(stderr);
28+
console.error(stdout);
2829
if (stdout.indexOf('Error') >= 0) {
2930
console.log("Tunnel launching failed");
3031
console.log(stdout);
@@ -44,6 +45,7 @@ var Tunnel = function Tunnel (key, port, tunnelIdentifier, callback, err) {
4445
}, 30 * 1000);
4546

4647
subProcess.stdout.on('data', function (_data) {
48+
console.log(_data);
4749
if (running) {
4850
return;
4951
}

0 commit comments

Comments
 (0)