simplecov icon indicating copy to clipboard operation
simplecov copied to clipboard

Rails 7.1 update => test coverage drop

Open lafeber opened this issue 1 year ago • 6 comments

Issue occurs when bumping rails from 7.0.8 to 7.1.0. No other changes in code.

We run minitest, with Rails 7.1 the line coverage of some files (mostly concerns) dropped from 100% to 0%.

before: image

after: image

I don't know how much code I'm allowed to share; it's code that's called indirectly in the tests.

simplecov is at 0.22.0

ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-darwin21]

Edit: this is without parallelisation.

lafeber avatar Oct 13 '23 11:10 lafeber

I'm also having trouble getting Simplecov to work with my "out of the box" rails minitest test suite (only have model tests and integration tests). I followed the install instructions and made the suggested changes to both the test/test_helper.rb file as well as the change to bin/rails.

@lafeber One thing I've done to produce different results is comment out this line in my test/test_helper.rb file:

parallelize(workers: :number_of_processors)

I don't think this is the fix but see what it does for you...

leesmith avatar Oct 14 '23 19:10 leesmith

Have a look at https://github.com/simplecov-ruby/simplecov/issues/718

srabuini avatar Oct 26 '23 17:10 srabuini

I'm running into this as well. @colszowka Can you take a look at this please?

matteeyah avatar Oct 31 '23 23:10 matteeyah

I'm having the same issue with Rspec instead of Minitest. Only on our Rails 7.1 branch

yknx4 avatar Jan 10 '24 16:01 yknx4

We're getting similar results, specifically with controllers. Other files are being covered correctly. Confirmed that simplecov is being initialized before controllers run. Running Rails 7.1 + minitest.

EDIT: My issue was Rails test parallelization. Fix here: https://github.com/simplecov-ruby/simplecov/issues/718#issuecomment-538201587

dtgay avatar Jan 11 '24 19:01 dtgay

I've managed to "fix" it following this issue: https://github.com/simplecov-ruby/simplecov/issues/1082

lafeber avatar Mar 18 '24 14:03 lafeber