Angular Mocks

Overview of Angular Mocks

  • allows you to create mocks for unit testing testing AngularJS
  • The command below will install the ngMock module
bower install angular-mocks

Modifying the karma.config file to work with AngularMocks

  • View your karma.config file.
  • You will need to add a line that references the angular-mocks component, like so:
files: [
   'bower_components/angular/angular.js',
   'bower_components/angular-mocks/angular-mocks.js',
   'app/**/*.js',
   'spec/**/*.js'
],
  • After this has been modified, ensure that it runs, by starting Karma
karma start