I have been browsing many questions regarding this problem and I still haven's figure this out. (vojtajina/ng-directive-testing didn't help much as well).
karma.conf.js
preprocessors: {
'app/components/partials/*.html': 'ng-html2js'
},
ngHtml2JsPreprocessor: {
stripPrefix: 'app/',
moduleName:'flickrNgSpaApp'
},
files: [
'app/**/*.js',
'app/components/**/*.js',
'test/mock/**/*.js',
'test/spec/**/*.js',
'app/components/partials/*.html'],
plugins: [
'karma-ng-html2js-preprocessor'
],
templateUrl: 'components/partials/thumbnails.html',
and my test
describe('Directive: thumbnailsDirective', function () {
var $compile, $rootScope, template;
beforeEach(module('flickrNgSpaApp', 'components/partials/thumbnails.html'));
beforeEach(inject(function(_$rootScope_, _$compile_, $templateCache)
template=$templateCache.get();
$templateCache.put());
...
Error: [$injector:modulerr] Failed to instantiate module components/partials/thumbnails.html..
Anyone please!what am i doing wrong?
You don't have to write the template filename, like this:
All your template files are already included in the fake module
flickrNgSpaApp
. And it's coherent with your error message, as template files are not modules.