Open ricsdeol opened 3 years ago
Are you sure you are running tests with spring disabled?
Are you sure you are running tests with spring disabled?
Yes, I removed from Gemfile, bin/spring and other references. I tried disable bootsnap at config/boot.rb
too.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
# require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
This looks really strange, because AFAIK the way Ruby Coverage
lib works, is it includes all the files that were required after Coverage.start
call which happens in SimpleCov.start
in this case.
I see you are calling rspec
without bundle exec
btw, maybe it's some custom script?
This looks really strange, because AFAIK the way Ruby
Coverage
lib works, is it includes all the files that were required afterCoverage.start
call which happens inSimpleCov.start
in this case.I see you are calling
rspec
withoutbundle exec
btw, maybe it's some custom script?
Hi, so I dont use custom script, ou bin/rspec. I tried with bundle exec and the problem continue :/
/myproject $ bundle exec rspec spec/models/accounts/
Randomized with seed 21737
........................................
Finished in 6.11 seconds (files took 11.87 seconds to load)
40 examples, 0 failures
Randomized with seed 21737
# result from
# def adapt_coverage_result
# covarage = Coverage.result
# @result = SimpleCov::ResultAdapter.call(covarage)
# puts covarage.filter {|k,_| k.start_with? '/myproject/' }.keys
# end
/myproject/spec/models/accounts/account_spec.rb
/myproject/spec/rails_helper.rb
/myproject/config/environment.rb
/myproject/config/application.rb
/myproject/config/boot.rb
/myproject/lib/extensions/elastic_search.rb
/myproject/config/environments/test.rb
Coverage report generated for RSpec to /myproject/coverage. 14 / 21331 LOC (0.07%) covered.
@ricsdeol You could try setting eager loading see if that makes a difference. It might also be worth seeing what other gems were updated during your original update, maybe one of them is causing your app dir to be loaded during the bundler initialization process when it loads gems
@ptrippett thank you
config.eager_load = true
Now my coverage result back to normal
Wow, for some reason I checked that and decided that false
is the value we need here. Maybe you can close the issue btw :)
With minitest, this combination worked for me (ruby 3.0.2p107, Rails 6.1.4.1):
In config/environments/test.rb
:
config.eager_load = true
Disable spring when running with:
DISABLE_SPRING=1 rails test
Please close
Hi after upgrade rails from: 5.0 to 5.2 the simplecov stopped monitoring the project ruby files at app/. I tried many things, like upgrade ruby, rspec, simplecov, reinstall looking doc configuration.
Troubleshooting
I cloned simplecov at vendor/ and put a breakpont at
adapt_coverage_result
mehod (/lib/simplecov.rb @ line 408
) and discoveryCoverage.result
is not monitoring any files on myprojct/app :(Versions
Ruby Version:
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux-musl]
same error happend on 2.6.7 Simplecov: 0.21.2 Rails: 5.2.5 Rspec:Config Files
spec/rails_helper.rb
spec/spec_helper.rb
config/environments/test.rb
Does Anyone could help me please?