Не удалось создать экземпляр модуля ng-html2js
Недавно я установил препроцессор ng-html2js, чтобы иметь возможность тестировать компоненты в karma-jasmine, однако я столкнулся с одной проблемой. Первый это здесь:
12 06 2018 23: 24: 55.832: WARN [веб-сервер]: 404: /views/home.controller.html
Я думаю, что карма не может найти мои HTML-файлы правильно, и второй является ошибка с Phantomjs: не могу найти переменную: требуется "
Это мой код:
describe('Testando o includeReplace - Directive', function() {
var scope, template, httpBackend, isolateScope;
beforeEach(module('DS-APP'));
beforeEach(module('ngTemplates'));
beforeEach(inject(function($compile, _$rootScope_, $httpBackend) {
scope = _$rootScope_.$new();
httpBackend = $httpBackend;
scope.varBind = {};
scope.varBind = {
};
var element = angular.element('ELEMENTO');
template = $compile(element)(scope);
scope.$digest();
isolateScope = element.isolateScope();
}));
afterEach(function() {
httpBackend.verifyNoOutstandingExpectation();
httpBackend.verifyNoOutstandingRequest();
});
it('devera gerar o HTML corretamente', function() {
var templateAsHtml = template.html();
});
});
Это мой karma.conf.js:
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'node_modules/jquery/dist/jquery.min.js',
'node_modules/angular/angular.js',
'node_modules/karma-ng-html2js-preprocessor/lib/html2js.js',
'node_modules/angular-sanitize/angular-sanitize.min.js',
'node_modules/angular-mocks/angular-mocks.js',
'node_modules/angular-animate/angular-animate.min.js',
'node_modules/angular-resource/angular-resource.js',
'node_modules/angular-sanitize/angular-sanitize.js',
'node_modules/moment/min/moment.min.js',
'node_modules/moment/locale/de.js',
'node_modules/angular-moment/angular-moment.min.js',
'node_modules/@uirouter/angularjs/release/angular-ui-router.min.js',
'app/index.ng.js',
'app/**/**.js',
'app/**/**.spec.js',
'app/**/*.html'
],
plugins: [
'karma-jasmine',
'karma-spec-reporter',
'karma-phantomjs-launcher',
'karma-ng-html2js-preprocessor'
],
exclude: [
],
preprocessors: {
'app/**/*.html': ['ng-html2js']
},
ngHtml2JsPreprocessor : {
stripPrefix: 'app/',
prependPrefix: '/views/',
moduleName : 'ngTemplates'
},
reporters: ['spec'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS'],
singleRun: false,
concurrency: Infinity
});
}
Изображение моей файловой организации