vendredi 31 juillet 2015

AngularJS Unit Testing with Karma in WebStorm:- Chrome 43.0.2357 (Windows 7 0.0.0): Executed 0 of 0 ERROR

I am new to AngularJs Unit Testing. I am using WebStorm for testing my simple angularjs app. but it will show this error. i dont understand what to do.

my karma.conf.js

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

basePath : './',

files : [
  'app/bower_components/angular/angular.js',
  'app/bower_components/angular-route/angular-route.js',
  'app/bower_components/angular-mocks/angular-mocks.js',
  'app/components/**/*.js',
  'app/view*/**/*.js',
  'app/test/*.js'
],

autoWatch : true,

frameworks: ['jasmine'],

browsers : ['Chrome'],

plugins : [
        'karma-chrome-launcher',
        'karma-firefox-launcher',
        'karma-jasmine',
        'karma-junit-reporter'
        ],

junitReporter : {
  outputFile: 'test_out/unit.xml',
  suite: 'unit'
}

}); };

my test.js:-

'use strict';

describe('myApp.view2 module', function() {

beforeEach(module('myApp.view2'));

var $controller;

beforeEach(inject(function($controller){ // The injector unwraps the underscores (_) from around the parameter names when matching $controller = $controller; }));

describe('PasswordCheckerController ', function(){

it('should be defined', inject(function($controller) {
  //spec body
  var view2Ctrl = $controller('PasswordCheckerController');
  expect(view2Ctrl).toBeDefined();
}));

  it('sets the strength to "strong" if the password length is > 8 chars', function() {
      var $scope = {};
      var controller = $controller('PasswordCheckerController', { $scope: $scope });
      $scope.password = 'longerthaneightchars';
      $scope.grade();
      expect($scope.strength).toEqual('strong');
  });

}); });

Aucun commentaire:

Enregistrer un commentaire