Testacular: encountered a declaration exception

北慕城南 提交于 2019-12-23 12:25:05

问题


I have defined a empty module in angular.js:

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

})

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

FAILED My own function encountered a declaration exception

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

How can I fix this problem?


回答1:


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



来源:https://stackoverflow.com/questions/15739763/testacular-encountered-a-declaration-exception

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