Skip to content
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

SimpleCov Coverage Report #705

Conversation

Harry-kp
Copy link
Contributor

@Harry-kp Harry-kp commented May 2, 2024

Description

fixes #699

  • This PR adds the functionality of generating a Code Coverage Report in Simple HTML format. The generation of code coverage is based on the ENV variable which is defaulted to true (meaning a report will be generated every time when the test runs).

@Harry-kp Harry-kp force-pushed the feature/added-simplecove-for-coverage branch from 71f23b9 to 5a333c0 Compare May 2, 2024 17:36
@Harry-kp Harry-kp force-pushed the feature/added-simplecove-for-coverage branch from 5a333c0 to 42ffc6f Compare May 2, 2024 17:38
Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

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

I pulled this down locally and ran it and for some reason, was getting some odd results. For example:

CleanShot 2024-05-02 at 19 26 39

We have test/models/upgrader_test.rb which tests a majority of upgrader.rb, but this coverage report shows 0% coverage.

Are you seeing a similar result locally?

@@ -51,6 +51,8 @@ group :development, :test do
gem "debug", platforms: %i[ mri windows ]
gem "brakeman", require: false
gem "rubocop-rails-omakase", require: false
gem "simplecov", require: false
gem "dotenv-rails"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think simplecov should only be in the :test group right?

Also, I recently moved dotenv-rails to the :development group only to avoid unexpected, failing tests when a dev has their .env setup incompatible with the test expectations. I think this will still work if we pass the ENV to the test command right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this should be in the test group and it works if we pass the env from the CMD. Working on changes

@zachgoll
Copy link
Collaborator

zachgoll commented May 2, 2024

@harrrykp also, for future PRs, would you mind configuring your Github email (in settings) to match your git client email? It makes it a little easier to review with a single user in the commit history.

@zachgoll
Copy link
Collaborator

zachgoll commented May 3, 2024

See: simplecov-ruby/simplecov#718

Looks like Rails test parallelization is causing coverage to drop:

parallelize(workers: :number_of_processors)

We should be seeing ~85% coverage on this codebase.

@Harry-kp
Copy link
Contributor Author

Harry-kp commented May 3, 2024

I pulled this down locally and ran it and for some reason, was getting some odd results. For example:

CleanShot 2024-05-02 at 19 26 39

We have test/models/upgrader_test.rb which tests a majority of upgrader.rb, but this coverage report shows 0% coverage.

Are you seeing a similar result locally?

Yes, happening same on my local.

@Harry-kp
Copy link
Contributor Author

Harry-kp commented May 3, 2024

See: simplecov-ruby/simplecov#718

Looks like Rails test parallelization is causing coverage to drop:

parallelize(workers: :number_of_processors)

We should be seeing ~85% coverage on this codebase.

Ohh, got it. Will be reviewing this issue for a possible solution.

@Harry-kp
Copy link
Contributor Author

Harry-kp commented May 3, 2024

@harrrykp also, for future PRs, would you mind configuring your Github email (in settings) to match your git client email? It makes it a little easier to review with a single user in the commit history.

Sure @zachgoll , need to check my git configs. Will fix this behaviour in future PRs.

@zachgoll zachgoll marked this pull request as draft May 8, 2024 12:33
@zachgoll
Copy link
Collaborator

@harrrykp closing this out for now. If you'd like to continue work on it just let me know and I'll re-open!

@zachgoll zachgoll closed this May 16, 2024
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.

Feature: Add Test Coverage Generation
3 participants