2013-10-22 16 views
16

Tôi đang cố gắng để chạy karma (version v0.10.2) kiểm tra đơn vị của tôi trên teamcity (version 7.1).Không thể tải "teamcity", nó không được đăng ký! Có lẽ bạn đang thiếu một số plugin?

Khi tôi chạy karma start --reporters teamcity --single-run tôi nhận được lỗi sau:

Can not load "teamcity", it is not registered! Perhaps you are missing some plugin? 

Tôi đã cài đặt các module nghiệp-TeamCity-phóng viên, nhưng điều đó hasn' t đã giúp.

Sau đây được cài đặt trong thư mục node_modules địa phương của tôi:

karma 
karma-chrome-launcher 
karma-coffee-preprocessor 
karma-coverage 
karma-firefox-launcher 
karma-html2js-preprocessor 
karma-jasmine 
karma-phantomjs-launcher 
karma-requirejs 
karma-script-launcher 
karma-teamcity-reporter 

Đây là karma.conf.js tôi:

I'm running karma version v0.10.2. Here's my karma.conf.js: 

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

     frameworks: ['jasmine'], 

     plugins: [ 
      'karma-jasmine', 
      'karma-coverage', 
      'karma-chrome-launcher', 
      'karma-phantomjs-launcher' 
     ], 

     // list of files/patterns to load in the browser 
     files: [ 
      'Scripts/jquery/jquery-2.0.2.min.js', 
      'Scripts/jquery-ui/jquery-ui-1.10.3.min.js', 
      'Scripts/daterangepicker/daterangepicker.js', 
      'Scripts/angular/angular.js', 
      'Scripts/angular/restangular/underscore-min.js', 
      'Scripts/angular/restangular/restangular-min.js', 
      'Scripts/angular/angular-*.js', 
      'Scripts/angular/angular-test/angular-*.js', 
      'Scripts/angular/angular-ui/*.js', 
      'Scripts/angular/angular-strap/*.js', 
      'Scripts/angular/angular-http-auth/*.js', 
      'Scripts/sinon/*.js', 
      'Scripts/moment/moment.min.js', 
      'uifw/scripts/ui-framework-angular.js', 
      'app/app.js', 
      'app/**/*.js', 
      'Tests/unit/**/*.js' 
     ], 


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

     // test results reporter to use 
     // possible values: 'dots', 'progress', 'junit' 
     reporters: ['progress', 'coverage', 'teamcity'], 

     preprocessors : { 
      'app/**/*.js': ['coverage'] 
     }, 

     coverageReporter : { 
      type: 'html', 
      dir: 'Tests/coverage/' 
     }, 

     // web server port 
     port : 9876, 

     // cli runner port 
     runnerPort : 9100, 

     // enable/disable colors in the output (reporters and logs) 
     colors : true, 


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


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

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

     // If browser does not capture in given timeout [ms], kill it 
     captureTimeout : 60000, 


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

Nếu tôi chạy karma start karma.conf.js nó chạy một cách chính xác. Tôi đang làm gì sai?

Trả lời

29

Hóa ra tôi cần phải thêm karma-teamcity-reporter đến phần plugins để có được điều này để làm việc:

... 

plugins: [ 
      'karma-teamcity-reporter', 
      'karma-jasmine', 
      'karma-coverage', 
      'karma-chrome-launcher', 
      'karma-phantomjs-launcher' 
     ], 

... 
+4

Bạn cũng có thể cần phải '' 'NPM cài đặt nghiệp-TeamCity-reporter''' –

+0

Brilliant. Đã tự hỏi tại sao nó không làm việc cho tôi. Cảm ơn. – Fernando

Các vấn đề liên quan