Testacular:遇到异常声明异常、声明、Testacular

由网友(メ雨辰ゞヤ)分享简介:我在angular.js定义了一个空的模块:I have defined a empty module in angular.js:angular.module('todoList', [], function () {})然后我要测试它,在我的 conf.js ,我加载这些JavaScript的:then I...

我在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.

阅读全文

相关推荐

最新文章