Created
February 5, 2016 13:40
-
-
Save ruffle1986/6c38ba4ac06819bd7de3 to your computer and use it in GitHub Desktop.
Code snippet to create browser-like environment with jsdom for integration tests.
This file contains hidden or 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
import { jsdom } from 'jsdom'; | |
const document = jsdom('<html><body><div id="root"></div></body></html>'); | |
const window = document.defaultView; | |
global.document = document; | |
global.window = window; | |
global.navigator = window.navigator; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment