This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
24 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rake/testtask' | ||
require 'json' | ||
|
||
Rake::TestTask.new do |test| | ||
test.test_files = Dir.glob('test/**/*_spec.rb') | ||
end | ||
|
||
Rake::Task['test'].enhance do | ||
# Temporary hack to get CodeClimate to work with SimpleCov 0.18 JSON format until issue is fixed | ||
# upstream: https://github.com/codeclimate/test-reporter/issues/413 | ||
if ENV['CI'] == 'true' | ||
def remove_lines_key(obj) | ||
case obj | ||
when Hash | ||
obj.transform_values do |val| | ||
val.is_a?(Hash) && val.key?('lines') ? val['lines'] : remove_lines_key(val) | ||
end | ||
else | ||
obj | ||
end | ||
end | ||
|
||
puts 'Patchin .resultset.json for CodeClimate compatability' | ||
filename = 'coverage/.resultset.json' | ||
contents = JSON.parse(File.read(filename)) | ||
# overwrite | ||
File.write(filename, JSON.generate(remove_lines_key(contents))) | ||
end | ||
end | ||
|
||
task(default: :test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters