Introduction
Installation
Find out how to install Simplecov Tailwind to your project and use the most out of it!
Setup
Add the below to your Gemfile to make Simplecov Tailwind available as a formatter for your application.
Ruby Gems Host
# ./Gemfile
group :test do
gem 'simplecov', require: false
gem 'simplecov-tailwindcss', require: false
end
Github Rubygems Host
# ./Gemfile
group :test do
gem "simplecov", require: false
end
source "https://rubygems.pkg.github.com/chiefpansancolt"
group :test do
gem "simplecov-tailwindcss", require: false
end
end
Usage
To use Simplecov Tailwind you will need to ensure your Formatter is set to use Simplecov Tailwind.
In your helper ensure your line about formatter usage is one of the following.
Ensure to add the require tag at the top of your helper class where Simplecov is configured
require 'simplecov-tailwindcss'
Single Formatter Usage
SimpleCov.formatter = SimpleCov::Formatter::TailwindFormatter
Multi Formatter Usage
SimpleCov.formatters =
SimpleCov::Formatter::MultiFormatter.new(
[SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::TailwindFormatter],
)
Sample
Here is an example usage in a test_helper.rb file for a minitest usage.
# test/test_helper.rb
require 'simplecov'
SimpleCov.profiles.define 'migrator_profile' do
load_profile 'test_frameworks'
add_filter %r{^/config/}
add_filter %r{^/db/}
add_filter %r{^/vendor/}
add_group 'Controllers', 'app/controllers'
add_group 'Helpers', 'app/helpers'
add_group 'Channels', 'app/channels'
add_group 'Models' do |src|
src.filename.include?('app/models') && !src.filename.include?('app/models/factories') &&
!src.filename.include?('app/models/salesforce_objects')
end
add_group 'Factories', 'app/models/factories'
add_group 'Salesforce Objects', 'app/models/salesforce_objects'
add_group 'Jobs', 'app/jobs'
add_group 'Generators', 'lib/generators'
track_files '{app,lib}/**/*.rb'
end
SimpleCov.start 'migrator_profile'
SimpleCov.minimum_coverage 90
SimpleCov.formatter = SimpleCov::Formatter::SimplecovFormatter