diff --git a/bin/zuul b/bin/zuul index c85c84a..46f5b3e 100755 --- a/bin/zuul +++ b/bin/zuul @@ -27,6 +27,7 @@ program .option('--electron', 'run tests in electron. electron must be installed separately.') .option('--tunnel-host ', '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 ', 'hostname to use instead of localhost, to accomodate Safari and Edge with Sauce Connect. Must resolve to 127.0.0.1') .option('--server ', 'specify a server script to be run') .option('--list-available-browsers', 'list available browsers and versions') .option('--browser-name ', 'specficy the browser name to test an individual browser') @@ -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, diff --git a/lib/setup.js b/lib/setup.js index 2dd2baf..2861880 100644 --- a/lib/setup.js +++ b/lib/setup.js @@ -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; @@ -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); }; } @@ -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);