rspec-expectations icon indicating copy to clipboard operation
rspec-expectations copied to clipboard

Get test coverage of all code that's not version-specific up to 100%

Open myronmarston opened this issue 10 years ago • 5 comments

We did this previously in rspec-core in rspec/rspec-core#1905. All code that is not currently covered should be looked at, and it should be determined which of these categories it's in:

  • Dead code that can be deleted.
  • Code that's only for older versions of Ruby (or JRuby or whatever). Tag it with # :nocov: so it's not included the coverage percent calculation.
  • Code that can and should be covered by a new test.

myronmarston avatar Apr 11 '15 23:04 myronmarston

I know this is ancient, but it's actually pretty close already - after tagging the version-specific code with :nocov:, there are only a total of 18 lines uncovered; I'll tackle the tests for those lines tomorrow.

Do we want to enforce 100% coverage in some way after it's achieved, perhaps with a (non-required) github status, or just by cranking the minimum coverage up to 100%? (Since that config probably wouldn't pass in some of the CI environments, we could specify 100% just in a particular ruby). Or would we rather just check in every few months and catch it back up? Given how close it already was, clearly the practices are not leaving much of a gap anyway :-)

nevinera avatar May 08 '24 01:05 nevinera

only a total of 18 lines uncovered; I'll tackle the tests for those lines

Nice!

non-required) github status, or just by cranking the minimum coverage up to 100%

That would be perfect. If we’d make it a separate GH check, we would have to run it on a specific Ruby version. We can pick the version that gets us closest to 100%

pirj avatar May 08 '24 05:05 pirj

I'd favour adding a check to our matrix running on the latest Ruby only, please note until I finish the monorepo work we need to apply such changes in rspec-dev and it will mean checking some flag to set which repos support 100% coverage enforcement

JonRowe avatar May 08 '24 08:05 JonRowe

I'd favour adding a check to our matrix running on the latest Ruby only, please note until I finish the monorepo work we need to apply such changes in rspec-dev and it will mean checking some flag to set which repos support 100% coverage enforcement

Meaning 3.3 for now, and not ruby-head?

Ah, if you're working on mono-repo-izing, I'll just do the actual coverage bit in this PR; we can talk enforcement in another ticket. Might be simplest to just defer that part until after you're done. (Guess I should take a look at the coverage of the other gem repos next!)

nevinera avatar May 08 '24 11:05 nevinera

Meaning 3.3 for now, and not ruby-head?

Yes, for us ruby-head is for "pre warning" of upcoming issues rather than enforcing any rules [and is generally allowed to fail]

JonRowe avatar May 08 '24 13:05 JonRowe

I think #1458 resolved this finally :-)

nevinera avatar Aug 18 '24 19:08 nevinera