简体   繁体   English

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

[英]Karma error Cannot call method 'module' of undefined

I am getting this error when running test.sh . 运行test.sh时出现此错误。 (I think I got test.sh from the aungular-seed project) (我想我是从非种子项目获得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

Why? 为什么?

You need to include angular.js in your karma.conf.js file: 'public/lib/angular*/angular.js' 您需要在您的karma.conf.js文件中包含angular.js: 'public/lib/angular*/angular.js'

This solved the problem for me, but maybe there is a better way also. 这为我解决了问题,但也许还有更好的方法。 See also the karma.conf.js file from the angular-seed project . 另请参阅angular-seed项目中karma.conf.js文件

config/karma.conf.js: 配置/ 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'
],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM