Skip to content

Instantly share code, notes, and snippets.

@pwfcurry
Created March 27, 2018 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwfcurry/b131ff1df0dee9d948e265e34c60b665 to your computer and use it in GitHub Desktop.
Save pwfcurry/b131ff1df0dee9d948e265e34c60b665 to your computer and use it in GitHub Desktop.
Using babel, jsdom and sinonChai with intellij/gulp
// Used to run mocha tests within intellij. Provide "--require setupMocha" to mocha to use this
require("babel/register");
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"
};
chai.use(sinonChai);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment