4

我面临以下问题,试图在 .travis.yml 上执行代码气候报告:

Code Climate 遇到异常:CodeClimate::TestReporter::InvalidPayload No source files were found in the test report payload

这里有人可以帮助我吗?

4

2 回答 2

2

添加

require "codeclimate-test-reporter"
CodeClimate::TestReporter.start

在文件的开头spec_helper.rb

于 2015-10-18T07:47:58.007 回答
1

您可以发布您的 spec_helper.rb 文件吗?这个错误可能是由于很多原因:

  • 调用 SimpleCov.start 和 CodeClimate::TestReporter.start

    • 而是尝试 SimpleCov.start CodeClimate::TestReporter.configuration.profile
  • 添加 SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, CodeClimate::TestReporter::Formatter ]

  • 所以,最终的 spec_helper.rb 是这样的:

    require "codeclimate-test-reporter" <br>
    require 'simplecov'
    
    SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[SimpleCov::Formatter::HTMLFormatter,CodeClimate::TestReporter::Formatter]
    
    dir = File.join("..", "coverage")
    SimpleCov.coverage_dir(dir)
    SimpleCov.start CodeClimate::TestReporter.configuration.profile
    
于 2015-02-26T05:29:29.897 回答