From 817cd29f002b72ce2cc0ea6408f04b9820911235 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 16 Oct 2016 17:36:24 +0300 Subject: [PATCH] try require from root --- src/webserver.js | 9 ++++----- test/authentication.js | 11 +++++++++++ test/mocks/newXhr.js | 7 ++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/webserver.js b/src/webserver.js index edffb47641..c11080fa1d 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -230,18 +230,17 @@ function listen(callback) { winston.info('Using ports 80 and 443 is not recommend; use a proxy instead. See README.md'); } - - var args = isSocket ? [socketPath] : [port, nconf.get('bind_address')]; - var bind_address = ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')) + ':' + port; + var bind_address = ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')); + var args = isSocket ? [socketPath] : [port, bind_address]; var oldUmask; args.push(function (err) { if (err) { - winston.info('[startup] NodeBB was unable to listen on: ' + bind_address); + winston.info('[startup] NodeBB was unable to listen on: ' + bind_address + ':' + port); process.exit(); } - winston.info('NodeBB is now listening on: ' + (isSocket ? socketPath : bind_address)); + winston.info('NodeBB is now listening on: ' + (isSocket ? socketPath : bind_address + ':' + port)); if (oldUmask) { process.umask(oldUmask); } diff --git a/test/authentication.js b/test/authentication.js index 8694562d0f..c5d6e77586 100644 --- a/test/authentication.js +++ b/test/authentication.js @@ -11,6 +11,17 @@ var db = require('./mocks/databasemock'); describe('authentication', function () { var jar = request.jar(); + before(function(done) { + request({ + url: nconf.get('url') + '/api/config', + json: true, + jar: jar + }, function (err, response, body) { + console.log('lel', body); + done(); + }); + }); + it('should register and login a user', function (done) { request({ url: nconf.get('url') + '/api/config', diff --git a/test/mocks/newXhr.js b/test/mocks/newXhr.js index e63f30abbe..809fab59a8 100644 --- a/test/mocks/newXhr.js +++ b/test/mocks/newXhr.js @@ -4,7 +4,12 @@ var xhrPath = '../../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/xmlhttprequest-ssl'; // Make initial call to require so module is cached. -require(xhrPath); +try { + require(xhrPath); +} catch(e) { + require('xmlhttprequest-ssl'); +} + var name = require.resolve(xhrPath); // Get cached version.