0

My Module is :

var app = angular.module('customer',
[
    'customerAPI',
    'uldbfilters',
    'ngRoute',
    'ui.bootstrap',
    'nvd3',
    'chart.js',
    'ui.bootstrap.datetimepicker',
    'ui.dateTimeInput',
    'LocalStorageModule',
    'ngAnimate',
    'ngMaterial'
]);

My karma config file is :

module.exports = function(config) {
config.set({
   basePath: '',
   frameworks: [
       'jasmine',
       'jasmine-matchers'
   ],
   files: [
       '../../static/bower_components/jquery/dist/jquery.js',
       '../../static/bower_components/jquery-*/jquery-*.js',
       '../../static/bower_components/jquery-*/**/jquery-*.js',
       '../../static/bower_components/angular-charts/chart.js',
       '../../static/bower_components/angular/angular.js',
       '../../static/bower_components/angular-date-time-input/src/dateTimeInput.js',
       '../../static/bower_components/angular-bootstrap-datetimepicker/src/js/datetimepicker.js',
       '../../static/bower_components/angular-*/angular-*.js',
       '../../static/bower_components/angular-*/**/*.js',
       '../../static/rest/app/*.js',
       '../../static/rest/app/client/**/*.js',
       'test_suits_client/*.js'
   ],
   exclude: [
       '../../static/bower_components/angular-*/angular-*.min.js',
       '../../static/bower_components/angular-*/**/*.min.js',
       '../../static/bower_components/angular-*/**/index.js',
       '../../static/bower_components/angular-*/**/gulpfile.js',
       '../../static/bower_components/angular-*/**/karma.conf.js',
       '../../static/bower_components/angular-*/**/Gruntfile.js',
       '../../static/bower_components/angular-*/**/browserify.test.js'
   ],
   preprocessors: {},
   reporters: ['spec'],
   port: 9876,
   colors: true,
   logLevel: config.LOG_INFO,
   autoWatch: true,
   browsers: [
      'Firefox'
   ],
   singleRun: false,
   concurrency: Infinity
}

My test suite is :

describe('Customer Application uldb module functionality', function() {
    beforeEach(module('customer'));
        var scope;
        beforeEach(inject(function($rootScope){
            scope = $rootScope.$new();
        }));
        it('Sample spec to test 2 + 2', function() {
            expect(2 + 2).toEqual(4);
        });
    });
});

Now when i run karma, It is showing an exception of

minErr/<@/home/vhosts/uldb/static/bower_components/angular/angular.js:68:12 loadModules/<@/home/vhosts/uldb/static/bower_components/angular/angular.js:4640:15 forEach@/home/vhosts/uldb/static/bower_components/angular/angular.js:321:11 loadModules@/home/vhosts/uldb/static/bower_components/angular/angular.js:4601:5 createInjector@/home/vhosts/uldb/static/bower_components/angular/angular.js:4523:19 workFn@/home/vhosts/uldb/static/bower_components/angular-mocks/angular-mocks.js:3074:44 [3]http://localhost:9876/context.js:162:7

0

1 Answer 1

0

This problem is not regarding to $inject and it is purely based on your files loading in karma conf.js. I missed to load a library, in which current loading libraries is dependant on.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.