Last Updated: February 25, 2016
· weimeng

Using Code Climate's new test reporter together with Coveralls and SimpleCov's HTML Formatter

Code Climate just announced the addition of test coverage reporting to their suite of code quality tools. Exciting!

As I expected, Code Climate's codeclimate-test-reporter gem was using SimpleCov to power their test coverage reporting.

At work, we're already using Coveralls to track test coverage over time. In addition, I'm using SimpleCov's HTMLFormatter to generate local test coverage reports so I don't have to wait on our CI provider for coverage reports.

Thankfully, it was fairly simple to add Code Climate's own formatter into my SimpleCov workflow.

Add codeclimate-test-reporter to your Gemfile and at the top of spec_helper.rb:

require 'codeclimate-test-reporter'
require 'simplecov'
require 'coveralls'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov.start 'rails'


You can also find any updates to the code here:

2 Responses
Add your response

I used webmock for mocking external requests, so I had a problem with it blocking coveralls and codeclimate from submitting the reports, so I added this in:

RSpec.configure do |config|
  config.after(:suite) do

In addition, I amended your code such that only if the ENV variable is provided for the respective services do I add it to the formatter. See gist:

over 1 year ago ·