dimanche 18 septembre 2016

'Karma', 'Jasmine 'module is not defined [AngularJs Testing]

I searched all post on SO for this topic but none solve my problem. I try to test my filter but i get error that module is not defined. I included my angular-mock file i karma config and i have all depend ices in right order. Can anyone see the reason for such behavior from my code below?

TEST

describe('filter', function() {

beforeEach(angular.mock.module('myApp'));

 describe('reverse', function () {
   it('should reverse string', inject(function (reverse) {
       expect(reverse("ABC")).toEqual('BCA');
      }))
      })
     });

Karma.config

// Karma configuration


  module.exports = function(config) {
   config.set({

    // base path that will be used to resolve all patterns (eg. files,   exclude)
    basePath: '',


   // frameworks to use
  // available frameworks: http://ift.tt/1ft83uu
    frameworks: ['jasmine'],


   // list of files / patterns to load in the browser
    files: [
    'app/js/vendor/angular.min.js',
    'app/js/vendor/angular-mock.js',
    'app/js/angular.module.js',
    'app/js/angular.module.spec.js'
     ],


// list of files to exclude
exclude: [
],

 }

Aucun commentaire:

Enregistrer un commentaire