(window.beforeEach || window.setup)不是功能 [英] (window.beforeEach || window.setup) is not a function

查看:308
本文介绍了(window.beforeEach || window.setup)不是功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装与摩卡,phantomjs和伊斯坦布尔(咕噜)测试环境。它的伟大工程,到目前为止,但是当涉及到​​角测试我得到了一些问题。我希望(并且需要)用角嘲笑,但只要我有它在我的test.html,我得到了我的浏览器下面的控制台错误:

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:

未捕获类型错误:(window.beforeEach || window.setup)不是一个函数

在amgular-mocks.js匹配code是下列之一:

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

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

这既发生在当前版本(1.4.3)和一个旧版本,在另一个项目显然奏效。1.3.15

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

我是什么失踪?

推荐答案

我固定它。

问题是,我包括我的图书馆的(包括角mocks.js )的之前 mocha.js 这显然是行不通的。

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

这篇关于(window.beforeEach || window.setup)不是功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆