-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to remove defaults filters and document them better #803
Comments
Hi there @fadeltd ! Thanks for the bug report and the repro script! I'll try it out and see if I can reproduce it over here. Seems like a very unlikely bug but who am I to judge, maybe something in the code that checks if the file exists thinks it's hidden and doesn't exist. Not sure. edit: can reproduce! |
@fadeltd hi there, so seems this was proposed as an intentional change and past me agreed 😁 #721 - Problem is, that hidden filter is in the defaults and right now that's a bit harder to circumvent. Here's a little script shwocasing what you could do: require 'simplecov/no_defaults'
require "simplecov-html"
SimpleCov.start do
formatter SimpleCov::Formatter::HTMLFormatter
end
at_exit do
SimpleCov.set_exit_exception
SimpleCov.run_exit_tasks!
end
require_relative ".scripts/foo" For me however, the tasks here are more like:
|
Thank you so much for checking this and also detailed explanation.
I'm confused as hidden sub-directories like But thanks anyway 😊 good luck with the action plan. |
I've tried the workaround but it seems that simplecov now also includes all the libs on root Edit: I just need to add bundler filter root_filter to exclude require 'simplecov/no_defaults'
require 'simplecov-html'
require 'simplecov/profiles/root_filter'
SimpleCov.start do
formatter SimpleCov::Formatter::HTMLFormatter
load_profile 'root_filter'
end
at_exit do
SimpleCov.set_exit_exception
SimpleCov.run_exit_tasks!
end
require_relative ".scripts/foo" |
@fadeltd yeah the filter only removes paths where the first folder is a hidden folder. Which, I think is fair-ish. But yeah root filter or manual "add_filter"s might need to be added. There's a surprising amount of things in the defaults such as the command guesser as well: https://github.com/colszowka/simplecov/blob/master/lib/simplecov/defaults.rb |
ruby version: 2.6.3
simplecov version: 0.17.1
test-unit version: 3.3.4
Issue
I have a project with some ruby scripts for CI purposes, and just now I'm creating unit tests for my ruby scripts, and I'm trying to get coverage from it with simplecov, but simplecov always gives me
0.0 / 0.0 LOC (100.0%) covered
.Here's sample script to reproduce the issue
test_calculator.rb
.scripts/tool/calculator.rb
It seems that simplecov can't generate coverage for
require_relative
when the first directory name has.
prefixI've tried renaming my directory to
scripts/.tool/calculator
, and it worksHow can I fix this issue without having to rename my directory?
Thanks
The text was updated successfully, but these errors were encountered: