Angularjs Karma中的角度注入器模块错误
当我尝试在一个新项目上运行karma和jasmine时出现以下错误Angularjs Karma中的角度注入器模块错误,angularjs,jasmine,karma-runner,Angularjs,Jasmine,Karma Runner,当我尝试在一个新项目上运行karma和jasmine时出现以下错误 INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/ INFO [launcher]: Starting browser PhantomJS INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket RZqL_zkgcfP2w13UEtJj with id 40849718 Pha
INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket RZqL_zkgcfP2w13UEtJj with id 40849718
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
Error: [$injector:nomod] http://errors.angularjs.org/1.5.5/$injector/nomod?p0=brainiacLms
at /Users/christianeckenrodework/Sites/brainiac/bower_components/angular/angular.min.js:25
这是我的因果报应
# // Karma configuration
# // Generated on Fri May 13 2016 16:53:01 GMT-0400 (EDT)
module.exports = (config) ->
config.set
basePath: './'
frameworks: [ 'jasmine' ]
files: [
'bower_components/angular/angular.min.js'
'bower_components/angular-mocks/angular-mocks.js'
'web/app.coffee'
'web/controllers/*.coffee'
'test/**/*.coffee'
]
exclude: []
preprocessors: {
'test/**/*.coffee': [ 'coffee' ]
'web/**/*.coffee': [ 'coffee' ]
}
reporters: [ 'progress' ]
port: 9876
colors: true
logLevel: config.LOG_INFO
autoWatch: true
browsers: [ 'PhantomJS' ]
singleRun: false
concurrency: Infinity
据我所知,问题似乎是它找不到我的应用程序模块?找到了答案:我的测试抛出注入器错误的原因是因为我没有在我的karma.conf.js文件中包含我所有的应用程序依赖项我认为您需要更新配置文件并使用如下文件数组:
files: [
// bower:js
'bower_components/angular/angular.min.js'
'bower_components/angular-mocks/angular-mocks.js'
// more bower dependences here...
// endbower
'web/app.coffee',
'web/**/*.coffee',
'web/**/*.html',
'test/**/*.coffee',
]
只需确保在配置文件中包含所有脚本和模板文件
此外,如果你使用咕噜声或咕噜声,你可以在你的因果报应配置中自动注入鲍尔_组件