Reputation: 1792
I am trying to debug how my karma setup is not preprocessing my directive templates.
I hoped that by setting moduleName: foo
I could easily grab the module in Chrome debug console and see what's up, but trying angular.module('foo')
in the debug returns a no module found
error leading me to believe the issue is somewhere else.
I also tried changing the html preprocessor to some nonsense string hoping that karma would throw an error, but it does not. This leads me to think that the issue may be with not having the correct path for my templates, but if I change that path to something else, it does throw an error no files match this path
.
Are there any debug options/approaches that I'm missing? Is there a way to log what goes in/comes out of ng-html2js?
Here is my 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
});
};
Upvotes: 2
Views: 873
Reputation: 25523
Are there any debug options/approaches that I'm missing? Is there a way to log what goes in/comes out of ng-html2js?
Yes; karma start --log-level debug
will display DEBUG [preprocessor.html2js]
entries. However you'll only get those entries if the files
paths and the preprocessors
pattern are correct.
Upvotes: 2
Reputation: 1792
This appeared to be an issue with pathing because when I added the base path basePath: '../'
to my karma config and adjusted my files:
paths, the preprocessor worked correctly.
Upvotes: 1