diff --git a/src/index.js b/src/index.js index fa1f2d7..eecef13 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,13 @@ -global.window = require('jsdom').jsdom('').defaultView; -Object.keys(window).forEach(function(prop) { - if(typeof global[prop] === 'undefined') { - global[prop] = window[prop]; - } -}); +var jsdom = require('jsdom').jsdom; -module.exports = window; +module.exports = function() { + global.window = jsdom('').defaultView; + + Object.keys(window).forEach(function(prop) { + if(typeof global[prop] === 'undefined') { + global[prop] = window[prop]; + } + }); + + return window; +};