Skip to content

Added variable to enable simplecov in spec_helper.rb if and only if COVERAGE=true#7960

Open
mrafie1 wants to merge 7 commits into
MarkUsProject:masterfrom
mrafie1:edit-simplecov-coverage
Open

Added variable to enable simplecov in spec_helper.rb if and only if COVERAGE=true#7960
mrafie1 wants to merge 7 commits into
MarkUsProject:masterfrom
mrafie1:edit-simplecov-coverage

Conversation

@mrafie1
Copy link
Copy Markdown
Contributor

@mrafie1 mrafie1 commented May 19, 2026

Proposed Changes

(Describe your changes here. Also describe the motivation for your changes: what problem do they solve, or how do they improve the application or codebase? If this pull request fixes an open issue, use a keyword to link this pull request to the issue.)

  • Changed .github/workflows/test_ci.yml
    • Added COVERAGE variable under the job test_spec env section
    • COVERAGE set to true allowing for test coverage to be enabled by default for GitHub CI
  • Changed spec/spec_helper.rb
    • Added enable_coverage variable
      • Takes the value of true if and only if COVERAGE = TRUE in the .github/workflows/test_ci.yml file when GitHub Actions are running
      • Takes the value of true if and only if COVERAGE = TRUE when running MarkUs rspec test suite
    • Gated all code related to the simplecov gem under if statements
      • Code only runs when enable_coverage is true
Screenshots of your changes (if applicable)
Associated documentation repository pull request (if applicable)

Documentation Update: Link

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration) x

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

(Include any questions or comments you have regarding your changes.)

Currently updating the Wiki to include the new changes. I'll let you know when I'm done with it!

@mrafie1 mrafie1 changed the title Enable simplecov in spec_helper.rb when COVERAGE=true Added variable to enable simplecov in spec_helper.rb if and only if COVERAGE=true May 19, 2026
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 19, 2026

Coverage Report for CI Build 26249467980

Coverage remained the same at 90.225%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 49755
Covered Lines: 45861
Line Coverage: 92.17%
Relevant Branches: 2151
Covered Branches: 971
Branch Coverage: 45.14%
Branches in Coverage %: Yes
Coverage Strength: 128.16 hits per line

💛 - Coveralls

@mrafie1
Copy link
Copy Markdown
Contributor Author

mrafie1 commented May 19, 2026

PR for wiki changes is up 👍 link

@mrafie1 mrafie1 requested a review from david-yz-liu May 19, 2026 23:54
Comment thread .github/workflows/test_ci.yml Outdated
BUNDLE_WITHOUT: development:production:console:unicorn
RAILS_ENV: test
RSPEC_RENDER_VIEWS: true
COVERAGE: true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Keep these environment variables in alphabetical order

Comment thread spec/spec_helper.rb Outdated
c.lcov_file_name = 'lcov.info'
end
# Enable simplecov only when COVERAGE environment variable is set to true
simplecov_enable = ENV.fetch('COVERAGE', nil) == 'true'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A more conventional variable name is enable_simplecov (or perhaps enable_coverage, since in principle we may switch code coverage libraries in the future)

@mrafie1 mrafie1 requested a review from david-yz-liu May 21, 2026 20:16
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.

3 participants