Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using babel, jsdom and sinonChai with intellij/gulp
// Used to run mocha tests within intellij. Provide "--require setupMocha" to mocha to use this
var chai = require("chai");
var sinonChai = require("sinon-chai");
var jsdom = require("jsdom").jsdom;
global.document = jsdom("");
global.window = document.defaultView;
Object.keys(document.defaultView).forEach((property) => {
if (typeof global[property] === "undefined") {
global[property] = document.defaultView[property];
global.navigator = {
userAgent: "node.js"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.