2014-01-21 6 views
2

업과 함께 몇 가지 테스트를 시도했지만 제대로 작동하지 못했습니다. 내 응용 프로그램과 함께 작동 시키려고 시도한 후에 가능한 가장 간단한 테스트로 실행하려고 시도했지만 여전히 완료되지 않았습니다. 여기 카르마 테스트가 끝나지 않았습니다

내 karma.conf.js 파일입니다

// Karma configuration 
// http://karma-runner.github.io/0.10/config/configuration-file.html 

module.exports = function(config) { 
    config.set({ 
    // base path, that will be used to resolve files and exclude 
    basePath: '', 

    // testing framework to use (jasmine/mocha/qunit/...) 
    frameworks: ['jasmine'], 

    // list of files/patterns to load in the browser 
    files: [ 
     // 'app/bower_components/angular/angular.js', 
     // // 'app/bower_components/angular/angular-mocks.js', 
     // 'app/scripts/*.js', 
     // 'app/scripts/controllers/main.js', 
     // // 'test/mock/**/*.js', 
     // 'test/spec/**/*.js', 
     // // 'app/scripts/**/*.js,' 
     'testing.js' 
    ], 

    // list of files/patterns to exclude 
    exclude: ['angular-scenario.js'], 

    // web server port 
    port: 8080, 

    // level of logging 
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG 
    logLevel: config.LOG_INFO, 


    // enable/disable watching file and executing tests whenever any file changes 
    autoWatch: false, 


    // Start these browsers, currently available: 
    // - Chrome 
    // - ChromeCanary 
    // - Firefox 
    // - Opera 
    // - Safari (only Mac) 
    // - PhantomJS 
    // - IE (only Windows) 
    browsers: ['Chrome'], 


    // Continuous Integration mode 
    // if true, it capture browsers, run tests and exit 
    singleRun: false 
    }); 
}; 

여기에 testing.js 파일입니다

describe("hello", function(){ 
    it("Should fail automatically", function(){ 
     expect(false).toBe(true) 
    }); 
}); 

내가 반드시 얻는 결과는 다음과 같습니다

$ karma start karma.conf.js 
INFO [karma]: Karma v0.10.9 server started at http://localhost:8080/ 
INFO [launcher]: Starting browser Chrome 
INFO [Chrome 30.0.1599 (Mac OS X 10.7.5)]: Connected on socket dGANukHhgkPC3YyhyUrU 
INFO [Chrome 30.0.1599 (Mac OS X 10.7.5)]: Connected on socket HC8iGMv-VmeYX2UAyUrV 

내 테스트가 얼마나 성공했는지 알 수 없다.

도움 주셔서 감사합니다. 잘만되면 나는 hahha의 끝에 약간의 머리를 놓고 갈 것이다.

+0

이의 모든 결과가 나오면 Chrome이 테스트를 실행하지 않는 것 같습니다. 비슷한 문제에 직면했지만 어떻게 해결했는지 잊어 버렸습니다. 다른 브라우저를 사용해보십시오. 당신은 PhantomJS를 시험해보고 당신이 얻는 것을 보길 원할 것입니다. – yanhan

답변

3

이것은 예상되는 동작입니다.

single_run : true은 한 번 시험을 으로하고을 종료하는 것을 의미합니다.

single_run : false 의미 (이것은 분명하지 않음)을 의미합니다.

autowatch : true은 파일이 변경 될 때 트리거 실행 테스트를 의미합니다. 다음

karma start

그냥 카르마있을 것이다 실행

(당신처럼) false로autowatchsingle_run 세트 모두 이있는 경우, 초기화 및 실행을 트리거 할 뭔가를 기다립니다. 새 콘솔을 열고 할

karma run

(또는 '사실'로 위에서 언급 한 플래그 중 하나를 설정)하는 데 필요한 테스트를 실행 트리거하기 위해

그 경우

+0

이것은 나에게도 효과가 있습니다. 감사! – vichsu

관련 문제