我正在尝试调试我的karma设置没有预处理我的指令模板。
我希望通过设置moduleName: foo,我可以轻松地获取Chrome调试控制台中的模块并查看发生了什么,但在调试中尝试angular.module('foo')会返回一个no module found错误,让我相信问题出在其他地方。
我还尝试将html预处理器更改为一些无意义的字符串,希望karma会抛出一个错误,但它没有。这使我认为问题可能是没有正确的模板路径,但如果我将该路径更改为其他路径,则确实会抛出错误no files match this path。
有没有我遗漏的调试选项/方法?有没有办法记录ng-html2js传入/传出的内容?
这是我的karma.conf.js
module.exports = function(config) {
config.set({
plugins: [
// these plugins will be require() by Karma
'ng-html2js',
'jasmine',
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-chrome-launcher'
],
basePath: '',
// frameworks to use
frameworks: ['jasmine'],
files: [
APPLICATION_SPEC,
'../app/assets/javascripts/image-crop.js',
'../app/assets/javascripts/angular/**/*.js',
'../spec/javascripts/**/*_spec.js',
"../public/templates/**/*.html"
],
exclude: [
'./app/bower_components/angular/angular.min.js'
],
reporters: ['progress'],
preprocessors: {
'**/*.html': ['ng-html2js']
},
ngHtml2JsPreprocessor: {
stripPrefix: 'public/templates',
moduleName: 'foo',
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS', 'Chrome'],
singleRun: false
});
};发布于 2016-01-16 00:55:14
有没有我遗漏的调试选项/方法?有没有办法记录ng-html2js传入/传出的内容?
是;karma start --log-level debug将显示DEBUG [preprocessor.html2js]条目。但是,只有在files路径和preprocessors模式正确的情况下,才能获得这些条目。
发布于 2014-11-07 19:35:03
这似乎是路径的一个问题,因为当我将基本路径basePath: '../'添加到我的karma配置中并调整我的files:路径时,预处理器工作正常。
https://stackoverflow.com/questions/26791573
复制相似问题