sb-admin-angular
sb-admin-angular copied to clipboard
Tests failing
Tests fail in the current version.
I tryed modifying the MainCtrl to pass the default test: app/scripts/controllers/main.js
'use strict';
/**
* @ngdoc function
* @name sbAdminApp.controller:MainCtrl
* @description
* # MainCtrl
* Controller of the sbAdminApp
*/
angular.module('sbAdminApp')
.controller('MainCtrl', function($scope,$position) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
});
This is the error returned by grunt test:
PhantomJS 1.9.8 (Linux) Controller: MainCtrl should attach a list of awesomeThings to the scope FAILED
Error: [$injector:modulerr] Failed to instantiate module sbAdminApp due to:
Error: [$injector:modulerr] Failed to instantiate module oc.lazyLoad due to:
Error: [$injector:nomod] Module 'oc.lazyLoad' 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.
http://errors.angularjs.org/1.2.16/$injector/nomod?p0=oc.lazyLoad
at /home/jlopez/home_common/Reference/src/angularjs/sb-admin-angular/bower_components/angular/angular.js:1613
at ensure (/home/jlopez/home_common/Reference/src/angularjs/sb-admin-angular/bower_components/angular/angular.js:1535)
at module (/home/jlopez/home_common/Reference/src/angularjs/sb-admin-angular/bower_components/angular/angular.js:1823)
at /home/jlopez/home_common/Reference/src/angularjs/sb-admin-angular/bower_components/angular/angular.js:3781
It seems with the current karma config it is not able to inject oc.lazyLoad but I was not able to figure out how to modify it to make it work.
Same problem here.
I fixed it by change some files as below: bower.json
"oclazyload": "~0.6.0",
karma.conf.js
files: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-touch/angular-touch.js',
'bower_components/oclazyload/dist/ocLazyLoad.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/json3/lib/json3.js',
'bower_components/angular-loading-bar/build/loading-bar.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'bower_components/metisMenu/dist/metisMenu.js',
'bower_components/Chart.js/Chart.min.js',
'app/scripts/app.js',
'app/scripts/**/*.js',
'test/spec/**/*.js'
],
@thanhson1085 :+1: your solution did resolve this issue
@dothanhlam , you are welcome. Nice to meet Vietnamese guy here.