Skip to content
Open
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Add comprehensive coverage measurement with SimpleCov
Enhance test coverage measurement capabilities:

Changes:
- Configure SimpleCov with detailed settings in test_helper.rb
  - Add filters to exclude test/, config/, vendor/ directories
  - Add coverage groups (Controllers, Resources, Serializers, etc.)
  - Enable branch coverage tracking (Ruby 2.5+)
  - Configure multi-format output (HTML + Console)
- Clean up .gitignore (remove duplicate coverage entry)
- Update .dockerignore to exclude coverage artifacts
- Add coverage instructions to CLAUDE.md (local & Docker)

Test results with Rails 6.1.7.10:
- Line Coverage: 92.04% (3491/3793 lines)
- Branch Coverage: 85.13% (853/1002 branches)
- All 674 tests passing

Usage:
  COVERAGE=true bundle exec rake test
  docker-compose run -e COVERAGE=true rails-6.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
  • Loading branch information
koji-takao-sp and claude committed Jan 20, 2026
commit 77c9da2471541ad0d3f2e3e7ebf3ac9fddf59a7e
24 changes: 24 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,30 @@

if ENV['COVERAGE']
SimpleCov.start do
add_filter '/test/'
add_filter '/config/'
add_filter '/vendor/'

add_group 'Controllers', 'lib/jsonapi/acts_as_resource_controller'
add_group 'Resources', 'lib/jsonapi/resource'
add_group 'Serializers', 'lib/jsonapi/serializer'
add_group 'Processors', 'lib/jsonapi/processor'
add_group 'ActiveRelation', 'lib/jsonapi/active_relation'
add_group 'Routing', 'lib/jsonapi/routing'

track_files 'lib/**/*.rb'

# Optional: Set minimum coverage threshold
# minimum_coverage 90

# Enable branch coverage (requires Ruby 2.5+)
enable_coverage :branch if respond_to?(:enable_coverage)

# Formatting options
formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::SimpleFormatter # Console output
])
end
end

Expand Down