Skip to content

Instantly share code, notes, and snippets.

@peduarte
Created April 13, 2016 10:02
Show Gist options
  • Save peduarte/eb400127901183e9961a290d5681b1ba to your computer and use it in GitHub Desktop.
Save peduarte/eb400127901183e9961a290d5681b1ba to your computer and use it in GitHub Desktop.
jsdom + enzyme + ava
npm install --save-dev jsdom
// test-browser-env.js
import { jsdom } from 'jsdom';
global.document = jsdom('<body></body>');
global.window = document.defaultView;
global.navigator = window.navigator;
// package.json
"ava": {
"require": [
"./test-browser-env.js"
]
}
@flubox
Copy link

flubox commented Apr 7, 2017

thanks :)

@pablopaul
Copy link

thanks @peduarte,

everybody else can find a updated and working example here: https://gist.github.com/pablopaul/2d4bba03d9a1215061b0f4a9390c6b81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment