simplecov-ruby / simplecov

Code coverage for Ruby with a powerful configuration library and automatic merging of coverage across test suites
MIT License
4.75k stars 551 forks source link

doesn't count files under lib #12

Closed ywen closed 13 years ago

ywen commented 13 years ago

I have this rails project in which I try simplecov. I had 100% coverage. then I created a dummy class in lib, and put a dummy method into it. ran spec again, the coverage was still 100%. Now I moved the same file into app/model. the coverage changed to 98%. Why didn't the files under lib get counted?

colszowka commented 13 years ago

By default, Rails does not require files in lib - try a require 'yourlib' in your environment.rb or a model/controller class that uses the lib

lastobelus commented 11 years ago

however perhaps there is a deeper issue? see https://github.com/colszowka/simplecov/issues/221

tilo commented 2 years ago

@colszowka @amatsuda

so this means: if you use SimpleCov for getting coverage on a Ruby Gem, then you're out of luck, because it doesn't consider files under ./lib.

This feels completely broken.

the project description says: "Code coverage for Ruby" , not "for Rails"

this should be fixed.

PragTob commented 2 years ago

@tilo it works completely fine, you just need to require your code after simplecov was started as the README indicates. Many people use simplecov for gem code coverage and it's perfectly fine.