Testacular:遇到异常声明 [英] Testacular: encountered a declaration exception

查看:482
本文介绍了Testacular:遇到异常声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在angular.js定义了一个空的模块:

I have defined a empty module in angular.js:

angular.module('todoList', [], function () {

})

然后我要测试它,在我的 conf.js ,我加载这些JavaScript的:

then I want test it, in my conf.js, I load these javascript:

files = [
  JASMINE,
  JASMINE_ADAPTER,
  // lib
  '../js/lib/angular.min.js',
  '../js/lib/jquery-1.9.1.min.js',

  // our app
  '../js/project.js',

  // test file
  "test/*.js"
];

然后我想在测试文件测试一下:

Then I want test it in test file:

describe('My own function', function(){
    beforeEach(module('todoList'));
});

但是这一步告诉我

but this step tell me

失败我自己的函数遇到了一个声明例外

我不明白,为什么只是一个加​​载模块句子会导致错误的

I don't understand why just a load module sentence would cause wrong

我怎样才能解决这个问题呢?

How can I fix this problem?

推荐答案

尝试包括你的配置文件角mocks.js。

Try including angular-mocks.js in your config file.

这篇关于Testacular:遇到异常声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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