5
不斷給我這個錯誤:模塊'模板'不可用!您拼錯了模塊名稱或忘記加載模塊名稱。似乎不能得到'karma-ng-html2js-preprocessor'的工作
我在幾個Angular項目中實現了指令的單元測試,現在它似乎不會工作。這裏是我的karma.conf
module.exports = function(config){
config.set({
basePath : '../',
files : [
'webapp/lib/bower_components/angular/angular.js',
'webapp/lib/bower_components/angular-route/angular-route.js',
'webapp/lib/bower_components/angular-resource/angular-resource.js',
'webapp/lib/bower_components/angular-animate/angular-animate.js',
'webapp/lib/bower_components/angular-mocks/angular-mocks.js',
'webapp/lib/bower_components/jquery/jquery.js',
'webapp/lib/jasmine-jquery.js',
'webapp/js/components/**/*.html',
'webapp/app.js',
'webapp/js/**/*.js',
'test/unit/**/*.js',
{ pattern: 'webapp/stubs/*', watched: true, served: true, included: false }
],
preprocessors: {
'webapp/js/components/**/*.html': ['ng-html2js']
//'webapp/components/**/.js' : ['coverage']
},
autoWatch : true,
frameworks: ['jasmine'],
browsers : ['Chrome'],
plugins : [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-ng-html2js-preprocessor'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
},
ngHtm2JsPreprocessor: {
moduleName: 'templates'
}
});
};
我絕對100%肯定在給定的位置有.html文件。我仔細檢查了指示,它只是不會加載:beforeEach(module('templates'));
在spec文件中。
我在這裏錯過了什麼嗎?最有可能的:-)
- 編輯:在'webapp/js/components/**/*。html'路徑中忘了'js',仍然不起作用。
你見過[這個問題](http://stackoverflow.com/q/15214760/3049002)? – glepretre 2014-09-26 07:59:44