Dwight Watson's blog

Incorrect coverage reporting on Heroku CI

August 1, 2017

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'

A blog about Laravel & Rails by Dwight Watson;
developer of Roomies.com, myRent.co.nz, High School Notes & StudentVIP.com.au.

Follow me on Twitter, or GitHub.