2017-10-17 170 views
0

我們使用Jenkins的CI和SonarQube來獲得代碼質量。作爲一個Web框架,我們使用的是Angular(4)。問題是我們的詹金斯可以建立我們的項目,但不能運行茉莉花測試。我嘗試了一些東西,但沒有奏效。我想讓詹金斯運行我們的測試,並將覆蓋數據提供給sonarqube。有沒有人可以解釋如何配置項目和jenkins來做到這一點,或者可以鏈接到教程。使用Jenkins運行Jasmine測試並覆蓋Sonarqube

這是我們的時刻

// Karma configuration file, see link for more information 
// https://karma-runner.github.io/1.0/config/configuration-file.html 

module.exports = function (config) { 
    config.set({ 
    basePath: '', 
    frameworks: ['jasmine', '@angular/cli'], 
    plugins: [ 
     require('karma-jasmine'), 
      require('karma-chrome-launcher'), 
      require('karma-phantomjs-launcher'), 
     require('karma-jasmine-html-reporter'), 
     require('karma-coverage-istanbul-reporter'), 
      require('@angular/cli/plugins/karma'), 
      require('karma-junit-reporter'), 
      require('karma-mocha-reporter') 
    ], 
    client:{ 
     clearContext: false // leave Jasmine Spec Runner output visible in browser 
    }, 
    coverageIstanbulReporter: { 
     reports: [ 'html', 'lcovonly' ], 
     fixWebpackSourcePaths: true 
    }, 
    angularCli: { 
     environment: 'dev' 
    }, 
     reporters: ['mocha', 'junit'], 
    port: 9876, 
    colors: true, 
    logLevel: config.LOG_INFO, 
    autoWatch: false, 
    browsers: ['Chrome'], 
     singleRun: true, 

     junitReporter: { 
      outputDir: 'build/test-results/karma', 
      outputFile: 'karma-test.xml', 
      useBrowserName: true 
     }, 
    }); 
}; 

回答

相關問題