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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ DB_PORT=5432
POSTGRES_PASSWORD=postgres
POSTGRES_USER=postgres

# Coverage Report
ENABLE_CODE_COVERAGE_REPORT=true

# App Domain
# This is the domain that your Maybe instance will be hosted at. It is used to generate links in emails and other places.
APP_DOMAIN=
Expand Down Expand Up @@ -47,7 +50,7 @@ HOSTING_PLATFORM=localhost
# UPGRADES_MODE: Controls how the app will upgrade. `manual` means the user must manually upgrade the app. `auto` means the app will upgrade automatically (great for self-hosting)
# UPGRADES_TARGET: Controls what the app will upgrade to. `release` means the app will upgrade to the latest release. `commit` means the app will upgrade to the latest commit.
#
UPGRADES_ENABLED=false # unless editing the flow, you should keep this `false` locally in development
UPGRADES_ENABLED=false # unless editing the flow, you should keep this `false` locally in development
UPGRADES_MODE=manual # `manual` or `auto`
UPGRADES_TARGET=release # `release` or `commit`

Expand All @@ -56,15 +59,15 @@ UPGRADES_TARGET=release # `release` or `commit`
# Git Repository Module - responsible for fetching latest commit data for upgrades
# ======================================================================================================
#
GITHUB_REPO_OWNER=maybe-finance
GITHUB_REPO_OWNER=maybe-finance
GITHUB_REPO_NAME=maybe
GITHUB_REPO_BRANCH=main

# ======================================================================================================
# Active Storage Configuration - responsible for storing file uploads
# ======================================================================================================
#
# * Defaults to disk storage but you can also use Amazon S3, Google Cloud Storage, or Microsoft Azure Storage.
# * Defaults to disk storage but you can also use Amazon S3, Google Cloud Storage, or Microsoft Azure Storage.
# * Set the appropriate environment variables to use these services.
# * Ensure libvips is installed on your system for image processing - https://github.com/libvips/libvips
#
Expand All @@ -74,4 +77,4 @@ GITHUB_REPO_BRANCH=main
# S3_ACCESS_KEY_ID=
# S3_SECRET_ACCESS_KEY=
# S3_REGION= # defaults to `us-east-1` if not set
# S3_BUCKET=
# S3_BUCKET=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ compose-dev.yaml

# Ignore GCP keyfile
gcp-storage-keyfile.json
coverage
6 changes: 6 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

SimpleCov.start 'rails' do
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
enable_coverage :branch
end
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

gem "i18n-tasks"
gem "erb_lint"
end
Expand Down
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ GEM
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
docile (1.4.0)
dotenv (3.1.1)
dotenv-rails (3.1.1)
dotenv (= 3.1.1)
Expand Down Expand Up @@ -392,6 +393,12 @@ GEM
sentry-ruby (5.17.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
sorbet-runtime (0.5.11367)
stackprof (0.2.26)
Expand Down Expand Up @@ -484,6 +491,7 @@ DEPENDENCIES
selenium-webdriver
sentry-rails
sentry-ruby
simplecov
stackprof
stimulus-rails
tailwindcss-rails
Expand Down
4 changes: 4 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
require "minitest/autorun"
require "mocha/minitest"

if ENV["ENABLE_CODE_COVERAGE_REPORT"] == "true"
require "simplecov" # Configuration details loaded from .simplecov
end

VCR.configure do |config|
config.cassette_library_dir = "test/vcr_cassettes"
config.hook_into :webmock
Expand Down