Karma错误无法调用undefined的方法'module'

时间:2013-11-12 20:54:28

标签: angularjs jasmine karma-runner

运行test.sh时出现此错误。 (我想我从aungular-seed项目得到了test.sh)

INFO [Chrome 26.0.1410 (Linux)]: Connected on socket gB-olqxn3xDa6fV2ENBw
Chrome 26.0.1410 (Linux) ERROR
    Uncaught TypeError: Cannot call method 'module' of undefined
    at /home/me/git/blah/blah/public/lib/angular-1.0.7/angular-cookies.js:15

为什么?

1 个答案:

答案 0 :(得分:7)

您需要在karma.conf.js文件中包含angular.js:'public/lib/angular*/angular.js'

这解决了我的问题,但也许有更好的方法。另请参阅karma.conf.js file from the angular-seed project

配置/ karma.conf.js:

// list of files / patterns to load in the browser
files: [
  'public/lib/angular*/angular.js',
  'public/lib/**/*.js',
  'public/js/**/*.js',
  'routes/**/*.js',
  'server/**/*.js',
  'test/unit/**/*Spec.js'
],