我用摩卡得到單元測試結果和伊斯坦布爾獲得代碼覆蓋率。我正在使用grunt來運行這些任務。它工作正常。我還使用grunt-sonar-runner
插件將這些結果導入聲納。目前代碼覆蓋率已導入,但單元測試結果並非如此。在生成過程中,聲納報告我:進口摩卡單位測試結果sonarqube
20:40:19.410 WARN - Test result will not be saved for test class "Account Controllers User Controller forgot password", because SonarQube associated resource has not been found using file name: "Account Controllers User Controller forgot password.js"
20:40:19.411 WARN - Test result will not be saved for test class "Account Controllers User Controller login", because SonarQube associated resource has not been found using file name: "Account Controllers User Controller login.js"
20:40:19.413 WARN - Test result will not be saved for test class "Account Controllers User Controller logout", because SonarQube associated resource has not been found using file name: "Account Controllers User Controller logout.js"
因此,聲納不保存單元測試結果。我嘗試在2.2中更改javascript插件版本,或者在5.1.1中升級聲納系統,但問題是相同的。我也嘗試重命名所有describe
函數以在文件夾之間形成文件的正確路徑.
(例如:test.unit.controllers.filename.
而我意識到它只適用於一個測試,如果您有超過1個測試,它將不起作用
配置:
*聲納(4.5.2)
* JavaScript的插件(2.7)
NPM模塊:
*摩卡聲納 - 報道(^ 0.1.3)
*摩卡:(^ 2.1 .0)
* grunt-mocha-test(^ 0.12.7)