No coverage with SimpleCov, Rake and Test :: Unit

While trying to generate code coverage statistics for ruby ​​storage, I hit a wall. I am using Rake to run Test :: 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 this:

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 of puts to check the load order (one at the top of my test file and one right after the simplecov dependencies declaration) to check that SimpleCov.start is encountered before the test code (as it should).

After reading this issue, it seems that simplecov and test-unit might not interact well with each other; Am I missing a workaround or should I switch to a different testing framework and if so which one and can I do it easily?

Thank!

+3


source to share





All Articles