0

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?

1 Answers1

0

You don't have to write the template filename, like this:

beforeEach(module('flickrNgSpaApp'));

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.

Toff'
  • 389
  • 3
  • 10
  • tnx for the try, but that wasn't the problem. I have solved this by torturing some combinations of paths in karma.conf and at some point it worked –  Aug 25 '15 at 13:26