Created
November 20, 2016 16:21
-
-
Save doque/c43f305ae7140b51fb7e667c71d98d89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('babel-register'); | |
require('mock-css-modules'); | |
const jsdom = require('jsdom').jsdom; | |
// Set up dummy DOM and provide `window` and `document.` | |
global.document = jsdom('<!doctype html><html><body></body></html>'); | |
global.window = document.defaultView; | |
const exposedProperties = ['window', 'navigator', 'document']; | |
Object.keys(document.defaultView).forEach((property) => { | |
if (typeof global[property] === 'undefined') { | |
exposedProperties.push(property); | |
global[property] = document.defaultView[property]; | |
} | |
}); | |
// Set variables and cookies here | |
global.navigator = { | |
userAgent: 'node.js', | |
plugins: [] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment