2014-03-04 20 views
0

這裏是我的配置文件:Instanbul保持傾銷覆蓋率報告HTML文件中錯誤的目錄

module.exports = function(config) { 
    config.set({ 
     basePath: './', 
     autoWatch: true, 
     frameworks: ['jasmine'], 
     files: [ 
      '../public_html/libs/mylib/lib.js', 
      '../public_html/libs/mylib/utility.js', 
      '../public_html/libs/mylib/config/*.js', 
      '../public_html/libs/mylib/enumerations.js', 
      '../public_html/libs/mylib/apiComm.js', 
      '../public_html/libs/mylib/baseObject.js', 
      '../public_html/libs/mylib/book.js', 
      '../public_html/libs/mylib/file.js', 
      '../public_html/libs/mylib/library.js', 
      '../public_html/libs/mylib/publishing.js', 
      '../public_html/libs/mylib/topic.js', 
      '../test/*Spec.js' 
     ], 
     reporters: ['progress', 'coverage'], 
     preprocessors: { 
      '../public_html/libs/mylib/topic.js': ['coverage'] 
     }, 
     port: 9876, 
     colors: true, 
     browsers: ['Chrome'], 
     captureTimeout: 60000, 
     singleRun: false 
    }); 
}; 

每當我跑karma start config/karma.config.js它運行單元測試,並會在正確的地方coverage文件夾。但是,它會將topic.js.html文件轉儲到與topic.js相同的目錄中。爲什麼?

回答

3

我知道這是遲到的答覆的集合,但它可能會幫助別人也是如此。

將您的配置文件了一個文件夾,並改變「../public_html」爲‘的public_html’

我剛剛做處理這個。

是的,你需要有...

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

...作爲阿科斯塔說,但你寫報告文件時要上去一個目錄,然後進入public_html文件夾還指示伊斯坦布爾。如果karma.conf.js文件位於與應用程序和測試文件夾相同的文件夾中,則報告應該在適當的位置呈現。

+0

謝謝 - 這個答案幫助我今天! – matt

1

你需要添加coverageReporter,

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

啊,你也可以增加記者

coverageReporter: { 
     reporters: [ 
      //{ type: 'html', dir: 'TestOutputFolder/' }, 
      { type: 'text-summary', dir: 'TestOutputFolder/' }, 
      { type: 'cobertura', dir: 'TestOutputFolder/' } 
     ] 
    }, 
相關問題