diff --git a/lib/setup.js b/lib/setup.js index 2861880..90c7641 100644 --- a/lib/setup.js +++ b/lib/setup.js @@ -12,18 +12,22 @@ function setup_test_instance(opt, cb) { var support_server = undefined; var bouncer = undefined; var Tunnel; + var tunnel; + if (typeof opt.tunnel === 'string') { Tunnel = require('zuul-' + opt.tunnel); debug('using zuul-%s to tunnel', opt.tunnel); } else if (typeof opt.tunnel === 'object' && opt.tunnel.type) { Tunnel = require('zuul-' + opt.tunnel.type); debug('using zuul-%s to tunnel', opt.tunnel.type); - } else { + } else if (opt.tunnel !== false) { Tunnel = require('zuul-localtunnel'); debug('using zuul-localhost to tunnel'); } - var tunnel = new Tunnel(opt); + if (Tunnel) { + tunnel = new Tunnel(opt); + } if (opt.server) { user_server(opt.server, setup); @@ -100,7 +104,7 @@ function setup_test_instance(opt, cb) { var app_port = bouncer.address().port; debug('bouncer active on port %d', app_port); - if (!config.tunnel) { + if (!tunnel) { return cb(null, 'http://' + loopback + ':' + app_port + '/__zuul'); } @@ -110,7 +114,10 @@ function setup_test_instance(opt, cb) { function shutdown() { bouncer.close(); - tunnel.close(); + + if (tunnel) { + tunnel.close(); + } if (support_server) { support_server.process.kill('SIGKILL');