1
카르마를 다른 디렉토리에 새로 설치할 때 앵귤러 시드 프로젝트를 테스트하려고합니다. Angular seed 프로젝트를 수정하지 않았습니다. myApp
및 myApp.View1Ctrl
이 정의되지 않은 이유는 무엇입니까?카르마 오류 : myApp가 정의되지 않았습니다.
describe("Unit Testing Examples", function() {
//beforeEach(angular.mock.module('myApp'));
beforeEach(module('myApp'));
it('should have a View1Ctrl controller', function() {
expect(myApp).toBeDefined();
expect(myApp.View1Ctrl).toBeDefined();
});
});
출력은 다음과 같습니다 :
내 시험은
INFO [watcher]: Changed file "C:/Projects/KarmaJasmine/KarmaJasmine/test/placeho
lder.js".
Chrome 37.0.2062 (Windows 8.1) Unit Testing Examples should have a View1Ctrl controller FAILED
ReferenceError: myApp is not defined
at null.<anonymous> (C:/Projects/KarmaJasmine/KarmaJasmine/test/plac
eholder.js:8:16)
Chrome 37.0.2062 (Windows 8.1): Executed 6 of 6 (1 FAILED) (0 secs/0.054 secs)
Chrome 37.0.2062 (Windows 8.1): Executed 6 of 6 (1 FAILED) (0.061 secs/0.054 s
ecs)
내 karma.conf은 다음 섹션을 가지고, 나는 파일이 존재 확인 :
files: [
'../AngularSeed/app/bower_components/angular/angular.js',
'../AngularSeed/app/bower_components/angular-route/angular-route.js',
'../AngularSeed/app/bower_components/angular-mocks/angular-mocks.js',
'../AngularSeed/app/app.js',
'../AngularSeed/app/components/**/*.js',
'../AngularSeed/app/view*/**/*.js'
, 'test/placeholder.js'
],
자세한 내용을 게시해야하는 경우 알려 주시기 바랍니다. 나는 비슷한 질문을 모두 읽으려고 시도했지만 대답을 찾지 못했습니다.
관련 http://stackoverflow.com/questions/21252369/getting-error-while-using-jasmine-with-angularjs. – alecxe