codeclimate / ruby-test-reporter

DEPRECATED Uploads Ruby test coverage data to Code Climate
https://codeclimate.com
Other
92 stars 92 forks source link

Simplify execution for open-source projects #179

Closed ioquatix closed 7 years ago

ioquatix commented 7 years ago

In my .simplecov I have:

# Enable coveralls in travis:
if ENV['TRAVIS']
    require 'coveralls'
    Coveralls.wear!
end

All my projects essentially have the same line.

In my Rakefile, to kick testing off:

RSpec::Core::RakeTask.new(:spec) do |task|
    begin
        require('simplecov/version')
        task.rspec_opts = %w{--require simplecov} if ENV['COVERAGE']
    rescue LoadError
            warn "Couldn't load simplecov for #{RUBY_VERSION}"
    end
end

And in .travis.yml:

env: COVERAGE=true

For completeness, my Gemfile is

group :test do
    gem 'simplecov'
    gem 'coveralls', require: false
end

This is a very simple setup.

I think this kind of setup is ideal. I have quite a few repos so the DRY principle, as much as is possible, is ideal.

ioquatix commented 7 years ago

Ideally, in .simplecov, it would be possible to have something like

require 'codeclimate-test-reporter/simplecov' if ENV['TRAVIS']

Another option would be to explore using .rspec, e.g.

--require codeclimate/coverage

And that sets everything up? Perhaps even just a local file, e.g. spec/coverage.rb which does it on a per-project basis.

dblandin commented 7 years ago

Hey @ioquatix ,

Thank for the issue!

As we're winding down development on this ruby-specific reporter, I'd recommend checking out our new test reporter and migrating to it if you're interested!

https://github.com/codeclimate/test-reporter https://codeclimate.com/changelog/591c99570d51f6481f001291

It's decoupled from the coverage tool used to generate the report, distributed as a static binary, and has support for parallelized builds. 🎉