2013-04-26 4 views
2
내가 각 프로젝트를 만들고 다음과 같이 정의 모듈을 가지고 보좌관 사용하고

되지 않습니다 : 다음과 같습니다 보좌관을 통해AngularJS와 + 재스민 테스트 스크립트 FN 실패하는 기능

angular.module('angularApp')<br /> 
.controller('LogOutCtrl', function ($scope) {//do stuff}); 

테스트 스크립트를 :

describe('Controller: LogOutCtrl', function() { 

    // load the controller's module 
    beforeEach(module('angularApp', ['ui', 'appSettings'])); 

    var LogOutCtrl, 
     scope; 

    // Initialize the controller and a mock scope 
    beforeEach(inject(function ($controller) { 
     scope = {}; 
     LogOutCtrl = $controller('LogOutCtrl', { 
      $scope: scope 
     }); 
    })); 

    it('should pass', function() { 
     expect(2+2).toBe(4); //aka some test 
    }); 
}); 
나는이를 작성하는 몇 가지 다른 방법을 살펴 보았다

Error: Argument 'fn' is not a function, got string 

:

이 꿀꿀/카르마를 통해 오류로 반환 잘 : How do I test an AngularJS service with Jasmine?

내가 앵귤러 및 재스민 테스트를 처음 접했을 때 도움을 받으실 수 있습니다. 나는 이것이 Yeoman의 테스트 스크립트 템플릿에 문제가 있다고 생각합니다.

감사합니다.

+0

와우 ... 이미 본 동일한 문제 : http://stackoverflow.com/questions/15870410/emit-generates-an-error-when-using-testacular-karma/15873703#15873703 내 대답 확인 . 그것의 yeoman 문제일지도 모르고 우리는 어딘가에 템플렛을 바꾸기 위하여 배치해야 하는가? –

+0

Yeoman으로 업그레이드하면 문제가 해결되었습니다. –

답변

2

이것은 Yeoman이 사용했던 템플릿의 문제점이었습니다. 그것들은 1.0 beta의 업데이트 이후에 해결되었습니다.