Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Commit

Permalink
support custom loopback hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
vweevers committed Sep 30, 2017
1 parent 8f8adf0 commit 4d4abe3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions bin/zuul
Expand Up @@ -27,6 +27,7 @@ program
.option('--electron', 'run tests in electron. electron must be installed separately.')
.option('--tunnel-host <host url>', 'specify a localtunnel server to use for forwarding')
.option('--sauce-connect [tunnel-identifier]', 'use saucelabs with sauce connect instead of localtunnel. Optionally specify the tunnel-identifier')
.option('--loopback <host name>', 'hostname to use instead of localhost, to accomodate Safari and Edge with Sauce Connect. Must resolve to 127.0.0.1')
.option('--server <the server script>', 'specify a server script to be run')
.option('--list-available-browsers', 'list available browsers and versions')
.option('--browser-name <browser name>', 'specficy the browser name to test an individual browser')
Expand All @@ -52,6 +53,7 @@ var config = {
prj_dir: process.cwd(),
tunnel_host: program.tunnelHost,
sauce_connect: program.sauceConnect,
loopback: program.loopback,
server: program.server,
concurrency: program.concurrency,
coverage: program.coverage,
Expand Down
7 changes: 4 additions & 3 deletions lib/setup.js
Expand Up @@ -35,6 +35,7 @@ function setup_test_instance(opt, cb) {
function setup(_support_server) {
support_server = _support_server;
var config = opt;
var loopback = config.loopback || 'localhost';
var control_port = opt.control_port;

var support_port = undefined;
Expand Down Expand Up @@ -65,12 +66,12 @@ function setup_test_instance(opt, cb) {
return function(req, res) {
var args = [].slice.call(arguments);
if (is_control_req(req)) {
args.push({ target: 'http://localhost:' + control_port });
args.push({ target: 'http://' + loopback + ':' + control_port });
bounce.apply(proxy, args);
return;
}

args.push({ target: 'http://localhost:' + support_port }, on_support_server_proxy_done);
args.push({ target: 'http://' + loopback + ':' + support_port }, on_support_server_proxy_done);
bounce.apply(proxy, args);
};
}
Expand Down Expand Up @@ -100,7 +101,7 @@ function setup_test_instance(opt, cb) {
debug('bouncer active on port %d', app_port);

if (!config.tunnel) {
return cb(null, 'http://localhost:' + app_port + '/__zuul');
return cb(null, 'http://' + loopback + ':' + app_port + '/__zuul');
}

tunnel.connect(app_port, cb);
Expand Down

0 comments on commit 4d4abe3

Please sign in to comment.