angularjs - unitTest karma-jasmine error -


hi guys have error when lunch start karma karma.conf.js

20%20%20%20at%20object.createinjector%20%5bas%20injector%5d%20(http%3a%2f%2flocalhost%3a9876%2fbase%2fwebcontent%2fassets%2fjs%2fangular1.4.3%2fangular.js%3fbede50a38baeba3db7a4df46069 5d01ecb437273%3a4272%3a11)%0a%20%20%20%20at%20object.workfn%20(http%3a%2f%2flocalhost%3a9876%2fbase%2fwebcontent%2fassets%2fjs%2fangular1.4.3%2fangular-mocks.js%3f8bc8772418adb9b2fa9517 2525c3540d23e140f4%3a2393%3a52)%0a%20%20%20%20at%20attemptsync%20(http%3a%2f%2flocalhost%3a9876%2fc%3a%2fusers%2fzack%2fnode_modules%2fjasmine-core%2flib%2fjasmine-core%2fjasmine.js%3f3 91e45351df9ee35392d2e5cb623221a969fc009%3a1886%3a24) @ webcontent/assets/js/angular1.4.3/angular.js:68:12 @ foreach (webcontent/assets/js/angular1.4.3/angular.js:336:20) @ loadmodules (webcontent/assets/js/angular1.4.3/angular.js:4346:5) @ object.createinjector [as injector] (webcontent/assets/js/angular1.4.3/angular.js:4272:11) @ object.workfn (webcontent/assets/js/angular1.4.3/angular-mocks.js:2393:52) @ webcontent/assets/js/angular1.4.3/angular.js:4385:15 chrome 51.0.2704 (windows 10 0.0.0): executed 4 of 4 (1 failed) (0.117 secs / 0.074 secs)

my karma.conf.js is:

module.exports = function(config) {   config.set({     // base path used resolve patterns (eg. files, exclude)     basepath: '',   // frameworks use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'],   // list of files / patterns load in browser files: [     'webcontent/assets/js/angular1.4.3/angular.js',     'webcontent/assets/js/angular1.4.3/angular-*.js',     'webcontent/assets/js/**/*.js',     'webcontent/apps/gapsweb/**/*.js',     'webcontent/apps/gapsweb/gaps.bootstrap.js',     'webcontent/apps/gapsweb/components/**/*.test.js' ],   // list of files exclude exclude: [     'webcontent/assets/js/translation/*.js' ],   // preprocess matching files before serving them browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { },   // test results reporter use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'],   // web server port port: 9876,   // enable / disable colors in output (reporters , logs) colors: true,   // level of logging // possible values: config.log_disable || config.log_error || config.log_warn || config.log_info || config.log_debug loglevel: config.log_info,   // enable / disable watching file , executing tests whenever file changes autowatch: true,   // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['chrome'],   // continuous integration mode // if true, karma captures browsers, runs tests , exits singlerun: true,  // concurrency level // how many browser should started simultaneous concurrency: infinity  })}; 

so problem?? wrong ?? guys hel me!!

so simple jasmine test work this:

    'webcontent/assets/js/angular1.4.3/angular.js',     'webcontent/assets/js/jquery1.11.3/jquery.js',     'webcontent/apps/gapsweb/**/*.js',     'webcontent/apps/gapsweb/gaps.bootstrap.js',     'webcontent/apps/gapsweb/components/**/*.test.js' 

but when write jasmine test (it's custom directive) :

describe('test menu directive', function () {     var element, scope;      beforeeach(function(){         module('commonbusinfo');          inject(function ($rootscope, $compile) {             scope = $rootscope.$new();             element = angular.element('<jeep-menu application="{{codappdirective}}"/>');             $compile(element)(scope);             scope.$digest();         })     });     it('proviamo ', function () {         console.log(111111);         var x = element.find('application');         x.triggerhandler('application');         scope.$digest();     });  }); 

this error:

       @ webcontent/assets/js/angular1.4.3/angular.js:68:12         @ foreach (webcontent/assets/js/angular1.4.3/angular.js:336:20)         @ loadmodules (webcontent/assets/js/angular1.4.3/angular.js:4346:5)         @ object.createinjector [as injector] (webcontent/assets/js/angular1.4.3/angular.js:4272:11)         @ object.workfn (webcontent/assets/js/angular1.4.3/angular-mocks.js:2393:52) 

%20%20%20%20at%20object.createinjector%20%5bas%20injector%5d%20(http%3a%2f%2flocalhost%3a9876%2fbase%2fwebcontent%2fassets%2fjs%2fangular1.4.3%2fangular.js%3fbede50a38baeba3db7a4df46069 5d01ecb437273%3a4272%3a11)%0a%20%20%20%20at%20object.workfn%20(http%3a%2f%2flocalhost%3a9876%2fbase%2fwebcontent%2fassets%2fjs%2fangular1.4.3%2fangular-mocks.js%3f8bc8772418adb9b2fa9517 2525c3540d23e140f4%3a2393%3a52)%0a%20%20%20%20at%20attemptsync%20(http%3a%2f%2flocalhost%3a9876%2fc%3a%2fusers%2fzack%2fnode_modules%2fjasmine-core%2flib%2fjasmine-core%2fjasmine.js%3f3 91e45351df9ee35392d2e5cb623221a969fc009%3a1886%3a24) chrome 51.0.2704 (windows 10 0.0.0) test menu directive proviamo failed referenceerror: module not defined @ object. (webcontent/apps/gapsweb/components/commons/menu/menu.directive.test.js:11:13) typeerror: cannot read property 'find' of undefined @ object. (webcontent/apps/gapsweb/components/commons/menu/menu.directive.test.js:22:28) log: 6969 chrome 51.0.2704 (windows 10 0.0.0): executed 2 of 2 (1 failed) (0.014 secs / 0.007 secs)

the directive is:

angular.module("commonbusinfo", []) .directive("jeepmenu", ['restangular', function(restangular){     // runs during compile     console.log("gapsmenudirective");     return {         restrict : 'e',         link : function (scope, element, attrs) {             var _urltemplate = '',_codapp = attrs.application;              if(angular.equals(_codapp,'gaps') || angular.equals(_codapp,'lirico') || angular.equals(_codapp,'topolino')){                 var utente = scope.userlogged;                 restangular.one('users', utente.codutente).one('readers', 'menu').one("commands", "menu")                     .get()                     .then(function (data) {                         scope.loadingpercentage += 20;                         scope.staticmenutest = data.bodyresponse.dataworkflow.innermenu;                         _urltemplate = 'components/commons/menu/menudynamicview.html';                     },function(err){                         scope.loadingerror = true;                     });                 scope.staticmenutest = [];             }             else{                 scope.loadingpercentage += 20;                 scope.staticmenutest = '';             }              scope.getcontenturl = function(){                 return _urltemplate;             }         },         template: '<div ng-include="getcontenturl()"></div>'     }; }]) 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -