diff --git a/.travis.yml b/.travis.yml index 87f3b854e9..ae39f99f96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ before_install: - "echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list" - "sudo apt-get update" - "sudo apt-get install mongodb-org-server" - - "npm i --production" + - "npm i" - sh -c "if [ '$DB' = 'mongodb' ]; then node app --setup=\"{\\\"url\\\":\\\"http://127.0.0.1:4567\\\",\\\"secret\\\":\\\"abcdef\\\",\\\"database\\\":\\\"mongo\\\",\\\"mongo:host\\\":\\\"127.0.0.1\\\",\\\"mongo:port\\\":27017,\\\"mongo:username\\\":\\\"\\\",\\\"mongo:password\\\":\\\"\\\",\\\"mongo:database\\\":0,\\\"redis:host\\\":\\\"127.0.0.1\\\",\\\"redis:port\\\":6379,\\\"redis:password\\\":\\\"\\\",\\\"redis:database\\\":0,\\\"admin:username\\\":\\\"admin\\\",\\\"admin:email\\\":\\\"test@example.org\\\",\\\"admin:password\\\":\\\"abcdef\\\",\\\"admin:password:confirm\\\":\\\"abcdef\\\"}\" --ci=\"{\\\"host\\\":\\\"127.0.0.1\\\",\\\"port\\\":27017,\\\"database\\\":0}\"; fi" - sh -c "if [ '$DB' = 'redis' ]; then node app --setup=\"{\\\"url\\\":\\\"http://127.0.0.1:4567\\\",\\\"secret\\\":\\\"abcdef\\\",\\\"database\\\":\\\"redis\\\",\\\"mongo:host\\\":\\\"127.0.0.1\\\",\\\"mongo:port\\\":27017,\\\"mongo:username\\\":\\\"\\\",\\\"mongo:password\\\":\\\"\\\",\\\"mongo:database\\\":0,\\\"redis:host\\\":\\\"127.0.0.1\\\",\\\"redis:port\\\":6379,\\\"redis:password\\\":\\\"\\\",\\\"redis:database\\\":0,\\\"admin:username\\\":\\\"admin\\\",\\\"admin:email\\\":\\\"test@example.org\\\",\\\"admin:password\\\":\\\"abcdef\\\",\\\"admin:password:confirm\\\":\\\"abcdef\\\"}\" --ci=\"{\\\"host\\\":\\\"127.0.0.1\\\",\\\"port\\\":6379,\\\"database\\\":0}\"; fi" before_script: diff --git a/package.json b/package.json index 774c69fcf2..9bf82fc2b3 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,8 @@ "istanbul": "^0.4.2", "mocha": "~3.1.0", "mocha-lcov-reporter": "^1.2.0", - "xmlhttprequest": "1.8.0" + "xmlhttprequest": "1.8.0", + "xmlhttprequest-ssl": "1.5.3" }, "bugs": { "url": "https://github.com/NodeBB/NodeBB/issues" diff --git a/test/mocks/newXhr.js b/test/mocks/newXhr.js index 809fab59a8..194cb97411 100644 --- a/test/mocks/newXhr.js +++ b/test/mocks/newXhr.js @@ -10,8 +10,13 @@ try { require('xmlhttprequest-ssl'); } +var name; +try { + name = require.resolve(xhrPath); +} catch(e) { + name = require.resolve('xmlhttprequest-ssl'); +} -var name = require.resolve(xhrPath); // Get cached version. var cachedXhr = require.cache[name]; var stdXhr = cachedXhr.exports; @@ -21,7 +26,7 @@ var callbacks = {}; var newXhr = function () { stdXhr.apply(this, arguments); - for (method in callbacks) { + for (var method in callbacks) { if (typeof callbacks[method] == "function") { callbacks[method].apply(this, arguments); }