Skip to content

Node.js based forum software built for the modern web

cleanup console.logs

barisusakli52a04306031a
diff --git a/test/mocks/newXhr.js b/test/mocks/newXhr.js
index f0a950df55..ba0e7fa7bd 100644
--- a/test/mocks/newXhr.js
+++ b/test/mocks/newXhr.js
@@ -1,25 +1,32 @@
// see https://gist.github.com/jfromaniello/4087861#gistcomment-1447029
// XMLHttpRequest to override.
-//var xhrPath = '../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/xmlhttprequest';
-var xhrPath = '../../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/xmlhttprequest-ssl';
-var name;
+/* globals console, require, module */
+var npm2Path = '../../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/xmlhttprequest-ssl';
+var npm3Path = '../../node_modules/xmlhttprequest-ssl';
+var filePath;
+var winston = require('winston');
+
// Make initial call to require so module is cached.
try {
- require(xhrPath);
- name = require.resolve(xhrPath);
+ require(npm2Path);
+ filePath = require.resolve(npm2Path);
} catch (err) {
- console.log('err1', err);
+ if (err) {
+ winston.info('Couldn\'t find ' + npm2Path);
+ }
try {
- require('../../node_modules/xmlhttprequest-ssl');
- name = require.resolve('xmlhttprequest-ssl');
+ require(npm3Path);
+ filePath = require.resolve(npm3Path);
} catch (err) {
- console.log('err2', err);
+ if (err) {
+ winston.info('Couldn\'t find ' + npm3Path);
+ }
}
}
-console.log(name);
+winston.info('xmlhttprequest-ssl path: ' + filePath);
// Get cached version.
-var cachedXhr = require.cache[name];
+var cachedXhr = require.cache[filePath];
var stdXhr = cachedXhr.exports;
// Callbacks exposes an object that callback functions can be added to.
@@ -32,7 +39,7 @@ var newXhr = function () {
callbacks[method].apply(this, arguments);
}
}
-}
+};
newXhr.XMLHttpRequest = newXhr;