(window.beforeEach || window.setup) is not a function

I've tried to setup a testing environment with mocha, phantomjs and istanbul (and grunt). It works great so far, but when it comes to angular-testing i got some problems. I want (and need) to use angular-mocks, but as soon as I include it in my test.html, I get the following console-error in my browser:

Uncaught TypeError: (window.beforeEach || window.setup) is not a function

The matching code in angular-mocks.js is the following one:

(window.beforeEach || window.setup)(function() {
  annotatedFunctions = [];
  currentSpec = this;
});

This happens both for the current version (1.4.3) and for an old version which apparently worked in another project: 1.3.15.

What am I missing?

Answers:

Answer

I fixed it.

The problem was, that i included my librarys (including angular-mocks.js) before mocha.js which apparently doesn't work.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.