के दौरान' त्रुटि: अप्रत्याशित अनुरोध 'grunt karma
चलाते समय, निर्देशों में से एक परीक्षण टेम्पलेट लाने की कोशिश करते समय विफल रहता है। मैं एक preprocessor के रूप में ng-html2js का उपयोग कर रहा हूँ।'कर्मा एंगुलर यूनिट टेस्ट
'use strict';
describe('Directive: myDirective', function() {
// load the directive's module
beforeEach(module('myApp'));
beforeEach(module('templates'));
var element,
scope;
beforeEach(inject(function ($rootScope) {
scope = $rootScope.$new();
}));
it('should not show search area initially', inject(function ($compile) {
element = angular.element('<navbar></navbar>');
element = $compile(element)(scope);
scope.$digest();
expect(element.find('.myClass').hasClass('myClass')).toBe(true);
}));
});
जब मैं परीक्षण चलाने, मैं
Error: Unexpected request: GET /scripts/directives/myDirective/myDirective.html
मिलती है: यहाँ मेरी karma.conf.js
plugins: ['karma-chrome-launcher',
'karma-jasmine',
'ng-html2js',
'karma-ng-html2js-preprocessor'],
preprocessors: {
'app/scripts/directives/**/*.html': 'ng-html2js'
},
ngHtml2JsPreprocessor: {
moduleName: 'templates'
}
अपने परीक्षण में से कुछ है, मैं निम्नलिखित है ऐसा लगता है कि प्रीप्रोसेसर टेम्पलेट के जावास्क्रिप्ट संस्करण को सही ढंग से इंजेक्शन नहीं दे रहा है।
मैं भी beforeEach(module(''));
में टेम्पलेट का पथ का उपयोग कर की कोशिश की है, लेकिन वह ऐसी त्रुटि का कारण बनता है:
Error: [$injector:modulerr] Failed to instantiate module...
मैं इसे कैसे ठीक कर सकते हैं?