Skip to content

Instantly share code, notes, and snippets.

View andrewagain's full-sized avatar

Andrew andrewagain

View GitHub Profile
@andrewagain
andrewagain / jsdom.js
Last active May 7, 2016 19:42
jsdom with mocha
var jsdom = require('jsdom')
// setup the simplest document possible
var doc = jsdom.jsdom('<!doctype html><html><body></body></html>')
// get the window object out of the document
var win = doc.defaultView
// set globals for mocha that make access to document and window feel
// natural in the test environment