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

£可爱£侵袭症+ 提交于 2019-12-20 02:59:29

问题


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


回答1:


I fixed it.

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



来源:https://stackoverflow.com/questions/31581092/window-beforeeach-window-setup-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!