2014-01-06 19 views
3

中找不到單元測試由於某些原因,當我運行此Karma.conf時,測試運行器運行時沒有錯誤,但它實際上並未在* Spec.js文件中運行我的任何測試。有任何想法嗎?Karma在* Spec.js

// Karma configuration 
// Generated on Fri Jan 03 2014 12:02:32 GMT+0000 (GMT) 

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

     // base path, that will be used to resolve files and exclude 
     basePath: '', 


     // frameworks to use 
     frameworks: ['jasmine'], 


     // list of files/patterns to load in the browser 
     files: [ 
      '../../root/angular/angular.js', 
      //'angular/angular-mocks.js', 
      '../../root/angular/**/*.js', 
      // 't/js/angularTest/process/filtersSpec.js', 
      'angularTest/**/*Spec.js' 
     ], 


     // list of files to exclude 
     exclude: [ 

     ], 


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

     preprocessors:{ 
      '**/*.js':'coverage' 
     }, 

     // web server port 
     port: 9876, 


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


     // level of logging 
     // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.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 (has to be installed with `npm install karma-opera-launcher`) 
     // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 
     // - PhantomJS 
     // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 
     browsers: ['Chrome'], 


     // 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: false 
    }); 
}; 

,這是它是否有助於從噶我的輸出:

/usr/bin/node /home/me/Desktop/WebStorm-131.515/plugins/js-karma/js_reporter/karma-intellij/lib/intellijRunner.js --karmaPackageDir=/usr/lib/node_modules/karma --serverPort=9876 --urlRoot=/ 
Testing started at 10:04 ... 
Empty test suite. 

Process finished with exit code 0 
+0

@ inf3rno想通了!檢查答案 – FutuToad

+0

Yepp這些問題通過插件配置錯誤發生。在我的情況下,問題是與requirejs測試配置... – inf3rno

回答

7

的解決方案是不導入角文件:

angular-scenario.js 
+0

嗯奇怪,爲什麼? – inf3rno

+0

不知道!無論如何使用聚合物代替 – FutuToad

+1

刪除這對我工作。不是100%爲什麼。 –