no coverage with SimpleCov, Rake and Test::Unit

633 Views Asked by At

In trying to generate code coverage statistics for a ruby repository I hit a wall. I use Rake to run my Test::Unit unit tests, but cannot get SimpleCov to return anything other than

Coverage report generated for Unit Tests <a_folder>. 0.0 / 0.0 LOC (100.0%) covered.

rakefile.rb looks like:

require 'simplecov'
SimpleCov.start
SimpleCov.command_name 'Unit Tests'

desc 'Run unit tests'
task :test do
    sh 'ruby -I ./app test/test_*.rb'
end
task :default => :test

Adding the following as suggested by this issue did not help

module SimpleCov::Configuration
  def clean_filters
    @filters = []
  end
end

SimpleCov.configure do
  clean_filters
  load_adapter 'test_frameworks'
end

I also added a couple puts to verify load order (one at the top of my test file and one immediately after declaring the simplecov dependency) to verify that SimpleCov.start occurs before test code (as it should).

After reading this issue it appears that simplecov and test-unit may not play well together; am I missing a workaround, or should I switch to another testing framework, and if so, which one, and can I do it easily?

Thanks!

0

There are 0 best solutions below