Skip to content

Commit

Permalink
testing on nodev6
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Oct 16, 2016
1 parent 1a63672 commit 13719fc
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/mocks/newXhr.js
Expand Up @@ -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;
Expand Down

0 comments on commit 13719fc

Please sign in to comment.