No commit activity in last 3 years
No release in over 3 years
print coverage per test file
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

DEPRECATED use single_cov

print coverage for 1 test/spec file

Install

gem install simplecov-single_file_reporter

Usage

Simple setup

Print coverage percent when you run a single file

require "simplecov/single_file_reporter"
SimpleCov.start
SimpleCov::SingleFileReporter.print
ruby test/a_test.rb
1 tests, 1 assertions
lib/a.rb coverage: 80.0

Customizing file-finding rules

SingleFileReporter needs to find the file that is tested.

test/test_xxx.rb -> lib/xxx.rb or app/xxx.rb

If it's something common, make a pull request.
If your app has special rules you can add them:

class MyReporter < SimpleCov::SingleFileReporter
  remove :file_under_test
  def self.file_under_test(test_file)
    super(test_file) || test_file.split("test/").last.sub("foo", "bar").sub("_test.rb", ".rb")
  end
end

SimpleCov.start
MyReporter.print

Authors

Michael Grosser
michael@grosser.it
License: MIT
Build Status