From 13719fccfeef6c1abe9efdecd8af06c3b18d1e11 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 16 Oct 2016 22:19:30 +0300 Subject: [PATCH] testing on nodev6 --- test/mocks/newXhr.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/mocks/newXhr.js b/test/mocks/newXhr.js index 194cb97411..f0a950df55 100644 --- a/test/mocks/newXhr.js +++ b/test/mocks/newXhr.js @@ -2,21 +2,22 @@ // 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; // Make initial call to require so module is cached. try { require(xhrPath); -} catch(e) { - require('xmlhttprequest-ssl'); -} - -var name; -try { name = require.resolve(xhrPath); -} catch(e) { - name = require.resolve('xmlhttprequest-ssl'); +} catch (err) { + console.log('err1', err); + try { + require('../../node_modules/xmlhttprequest-ssl'); + name = require.resolve('xmlhttprequest-ssl'); + } catch (err) { + console.log('err2', err); + } } +console.log(name); // Get cached version. var cachedXhr = require.cache[name]; var stdXhr = cachedXhr.exports;