I am using command:
mocha --compilers :./test/babel-setup.js --recursive --watch
It is giving error:
ReferenceError: window
Since I was doing too much with the window object, I just used this code to determine if I was in mocha or not.
function isMocha(){
let context = (global || window);
return ['afterEach','after','beforeEach','before','describe','it'].every(function(functionName){
return context[functionName] instanceof Function;
});
}