2014-09-24 14 views
5

Continua a darmi questo errore: Modulo' templates 'non è disponibile! Hai sbagliato a scrivere il nome del modulo o hai dimenticato di caricarlo.Non riesco a ottenere 'karma-ng-html2js-preprocessore'do il suo lavoro

I testare le unità di implementazione delle direttive in diversi progetti Angular e ora non sembra funzionare. Ecco il mio karma.conf

module.exports = function(config){ 
config.set({ 

    basePath : '../', 

    files : [ 
     'webapp/lib/bower_components/angular/angular.js', 
     'webapp/lib/bower_components/angular-route/angular-route.js', 
     'webapp/lib/bower_components/angular-resource/angular-resource.js', 
     'webapp/lib/bower_components/angular-animate/angular-animate.js', 
     'webapp/lib/bower_components/angular-mocks/angular-mocks.js', 
     'webapp/lib/bower_components/jquery/jquery.js', 
     'webapp/lib/jasmine-jquery.js', 
     'webapp/js/components/**/*.html', 
     'webapp/app.js', 
     'webapp/js/**/*.js', 
     'test/unit/**/*.js', 
     { pattern: 'webapp/stubs/*', watched: true, served: true, included: false } 
    ], 

    preprocessors: { 
     'webapp/js/components/**/*.html': ['ng-html2js'] 
     //'webapp/components/**/.js' : ['coverage'] 
    }, 

    autoWatch : true, 

    frameworks: ['jasmine'], 

    browsers : ['Chrome'], 

    plugins : [ 
     'karma-chrome-launcher', 
     'karma-firefox-launcher', 
     'karma-jasmine', 
     'karma-ng-html2js-preprocessor' 
    ], 

    junitReporter : { 
     outputFile: 'test_out/unit.xml', 
     suite: 'unit' 
    }, 

    ngHtm2JsPreprocessor: { 
     moduleName: 'templates' 
    } 
}); 
}; 

Sono assolutamente sicuro al 100% di file .html nella posizione specificata. Ho ricontrollato le istruzioni e non verrà caricato: beforeEach(module('templates')); nel file spec.

Mi manca qualcosa qui? Molto probabilmente :-)

--edit: dimenticato 'js' nel percorso 'webapp/js/components/**/*. Html', ancora non funziona.

+0

Hai visto [questa domanda] (http://stackoverflow.com/q/15214760/3049002)? – glepretre

risposta

0

Il messaggio di errore

Error: [$injector:modulerr] Failed to instantiate module templates due to: 
Error: [$injector:nomod] Module 'templates' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 

è riproducibile con l'installazione e la messa in vendita di karma-html2js-preprocessore nei vostri plugin

plugins : [ 
     'karma-chrome-launcher', 
     'karma-firefox-launcher', 
     'karma-jasmine', 
     'karma-junit-reporter', 
     'karma-html2js-preprocessor' 
     ], 

invece di karma-ng-html2js-preprocessore

plugins : [ 
     'karma-chrome-launcher', 
     'karma-firefox-launcher', 
     'karma-jasmine', 
     'karma-junit-reporter', 
     'karma-ng-html2js-preprocessor' 
     ], 
Problemi correlati