Skip to content

Commit

Permalink
Fix for new simplecov results file
Browse files Browse the repository at this point in the history
  • Loading branch information
szechyjs committed Mar 30, 2021
1 parent 0bc53bb commit f8e7ca4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/coverage_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def generate(type, report_path, data)
def simplecov(report_path, data)
report = read_json(report_path)
minumum_percent = data[:min]
covered_percent = report.dig('result', 'covered_percent')
covered_percent = report.dig('result', 'line') || report.dig('result', 'covered_percent')
{ 'lines' => { 'covered_percent' => covered_percent, 'minumum_percent' => minumum_percent } }
end

Expand Down
2 changes: 1 addition & 1 deletion lib/github_check_run_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def run
)['id']
@summary = @report_adapter.summary(@report)
@annotations = @report_adapter.annotations(@report)
@conclusion = @report_adapter.conslusion(@report)
@conclusion = @report_adapter.conclusion(@report)
@percent = @report_adapter.lines_covered_percent(@report)

@client.patch(
Expand Down
2 changes: 1 addition & 1 deletion lib/report_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class << self
CONCLUSION_TYPES = { failure: 'failure', success: 'success' }.freeze
ANNOTATION_LEVEL = { notice: 'notice', warning: 'warning', failure: 'failure' }.freeze

def conslusion(report)
def conclusion(report)
lines_covered_percent(report) >= lines_minimum_percent(report).to_f ? CONCLUSION_TYPES[:success] : CONCLUSION_TYPES[:failure]
end

Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/simplecov.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"result": {
"covered_percent": 80.5
"line": 80.5
}
}
4 changes: 2 additions & 2 deletions spec/report_adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

let(:adapter) { ReportAdapter }

it '.conslusion' do
result = adapter.conslusion(report)
it '.conclusion' do
result = adapter.conclusion(report)
expect(result).to eq('success')
end

Expand Down

0 comments on commit f8e7ca4

Please sign in to comment.