Skip to content

allow Coverage to start when Coverage.running? is not implemented#1043

Merged
PragTob merged 1 commit into
simplecov-ruby:mainfrom
notEthan:coverage_running
Apr 15, 2024
Merged

allow Coverage to start when Coverage.running? is not implemented#1043
PragTob merged 1 commit into
simplecov-ruby:mainfrom
notEthan:coverage_running

Conversation

@notEthan

Copy link
Copy Markdown
Contributor

Amends 1cc7650 from #1035

Another option would be to just call Coverage.start unconditionally and rescue the RuntimeError it now raises when already started.

@eregon eregon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, thank you!

Comment thread lib/simplecov.rb Outdated

def coverage_running?
Coverage.running?
rescue NoMethodError

@eregon eregon Dec 26, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if Coverage.respond_to? :running? seems nicer than rescue NoMethodError, notably because it avoids an exception in case it's not available (and doesn't catch other issues potentially).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my thought was that the much more common case will have Coverage.running? implemented so checking for that every time would be slower than rescuing in the rarer case. but this is not a place where slowness matters at all, and I do prefer not to use exceptions for control flow, so agree with you and have updated it.

@eregon

eregon commented Dec 26, 2022

Copy link
Copy Markdown
Contributor

FYI I'm planning to try adding TruffleRuby in CI to catch such issues faster, but that needs more work so I would suggest merging this first.

@eregon

eregon commented Dec 26, 2022

Copy link
Copy Markdown
Contributor

Confirmed this PR reduces bundle exec rake spec from 9 to just 1 failure on truffleruby-dev.

@notEthan

Copy link
Copy Markdown
Contributor Author

I also started looking yesterday at adding truffle to the CI here, but got hung up on aruba/childprocess, then saw that you were ahead of me and had opened an issue about the same already.

@eregon

eregon commented Dec 30, 2022

Copy link
Copy Markdown
Contributor

@PragTob @colszowka Hello, it would be great if this can be merged and released when you have some open-source time, because the latest release breaks a bunch of CIs testing TruffleRuby (e.g. see backlinks to this PR and #1044)

@notEthan

notEthan commented Jan 5, 2023

Copy link
Copy Markdown
Contributor Author

Yes, it would be quite helpful if this fix could make it into a release.

notEthan added a commit to notEthan/jsi that referenced this pull request Jan 9, 2023
@eregon

eregon commented Feb 8, 2023

Copy link
Copy Markdown
Contributor

Ping, please merge and release this. It's been one month and a half and it still breaks the CI of e.g. https://github.com/ronin-rb/ronin/actions/runs/4089986844/jobs/7053088486
Can I do anything to help with this?

@AlexWayfer

AlexWayfer commented Feb 25, 2023

Copy link
Copy Markdown

@sferik sferik force-pushed the main branch 9 times, most recently from 33cbb8e to 574b45c Compare December 26, 2023 16:15
@PragTob

PragTob commented Apr 15, 2024

Copy link
Copy Markdown
Collaborator

Thanks for this, sorry for all the silence. Life and more happend, been a tough year+. I'll merge, it should be fine famous simplecov maintainer last words

Thanks y'all for your work 💚

@notEthan : Very cute bunny avatar!

@PragTob PragTob merged commit 0c27173 into simplecov-ruby:main Apr 15, 2024
@notEthan

Copy link
Copy Markdown
Contributor Author

Thanks for merging. A release with this would make it usable.

@eregon

eregon commented Jun 10, 2024

Copy link
Copy Markdown
Contributor

@notEthan If the issue is SimpleCov 0.21.2 + TruffleRuby, that's solved in recent TruffleRuby releases and since #1044 (comment), because TruffleRuby has Coverage.running? since then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants