我正在尝试使用业力和茉莉花对所有指令进行单元测试。当我尝试加载具有名为 模板的指令时header.html
,我收到以下错误:Error: Unexpected request: GET header.html No more request expected
http://plnkr.co/edit/YTUFXCMdK5JFEwMzzXaR?p=preview
更新:我在 karma.conf.js 中有以下配置:
files: [
'test/client/specs/main.js',
// 'WebContent/modules/common/header/**/*.html',
{pattern: 'WebContent/libs/**/*.js', included: false},
{pattern: 'WebContent/modules/**/*.js', included: false},
{pattern: 'WebContent/modules/common/header/tmpl/*.html', included: false},
{pattern: 'test/client/specs/**/*spec.js', included: false}
],
// generate js files from html templates
preprocessors: {
'WebContent/modules/common/header/**/*.html': ['ng-html2js']
},
ngHtml2JsPreprocessor: {
'moduleName': 'Templates',
cacheIdFromPath: function(filepath) {
return filepath.match(/\/WebContent\/modules\/common\/header\/.*\.html/);
}
},
我正在尝试通过以下方式加载它:
beforeEach(function() {
module("Templates");
});
现在我收到以下错误:
Error: [$injector:modulerr] Failed to instantiate module Templates due to:
Error: [$injector:nomod] Module 'Templates' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.2.12/$injector/nomod?p0=Templates