Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(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?

like image 670
juliankern.com Avatar asked Jul 23 '15 07:07

juliankern.com


1 Answers

I fixed it.

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

like image 169
juliankern.com Avatar answered Sep 30 '22 19:09

juliankern.com