Struggling to configure the karma-ng-html2js-preprocessor. While Karma has been successfully detecting all my JavaScript files, it's having trouble generating a module from the HTML preprocessor.
Take a look at my options object below. I've specified a pattern for the files attribute and named the module 'foo'. However, whenever I attempt to call module('foo');
in the test, Karma throws an error. I really need this to work so that I can avoid hardcoding templates into my unit tests or using some other unconventional workaround.
var options = {
files: [].concat(
bowerFiles,
config.specHelpers,
clientApp + '**/*.module.js',
clientApp + '**/*.js',
clientApp + '**/*.html',
'*.html',
temp + config.templateCache.file,
config.serverIntegrationSpecs
),
exclude: [],
coverage: {
dir: report + 'coverage',
reporters: [
// reporters not supporting the `file` property
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'report-lcov' },
{ type: 'text-summary' } //, subdir: '.', file: 'text-summary.txt'}
]
},
ngHtml2JsPreprocessor: {
// strip this from the file path
// stripPrefix: clientApp,
moduleName: 'foo'
},
preprocessors: {}
};
options.preprocessors[clientApp + '**/*.html'] = ['ng-html2js'];
options.preprocessors[clientApp + '**/!(*.spec)+(.js)'] = ['coverage'];
return options;
}