Dwight Watson's blog

Incorrect coverage reporting on Heroku CI

This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.

I've recently started using Heroku CI to test my Heroku apps on Rails, but ran into a strange issue where Simplecov was reporting my code coverage at around 18%, where locally it was 100%. After a little bit of research I discovered the same sort of issue occured on Travis CI likely because of the location where it installed the app dependencies.

Luckily, it's an easy fix. Just adjust your Simplecov configuration in your spec_helper.rb - by filtering out the vendor directory third party code won't be included in your code coverage stats.

require 'simplecov'
SimpleCov.start :rails do
add_filter 'vendor'
end

A blog about Laravel & Rails by Dwight Watson;

Picture of Dwight Watson

Follow me on Twitter, or GitHub.