mirror of
https://github.com/ditkrg/simplecov-json.git
synced 2026-01-22 13:56:48 +00:00
Handle case where there was zero coverage data.
This commit is contained in:
parent
ba69ca37dd
commit
27e4088732
@ -14,7 +14,7 @@ class SimpleCov::Formatter::JSONFormatter
|
||||
filename: sourceFile.filename,
|
||||
covered_percent: sourceFile.covered_percent,
|
||||
coverage: sourceFile.coverage,
|
||||
covered_strength: sourceFile.covered_strength,
|
||||
covered_strength: sourceFile.covered_strength.nan? ? 0.0 : sourceFile.covered_strength,
|
||||
covered_lines: sourceFile.covered_lines.count,
|
||||
lines_of_code: sourceFile.lines_of_code,
|
||||
}
|
||||
@ -22,7 +22,7 @@ class SimpleCov::Formatter::JSONFormatter
|
||||
data[:groups] = result.groups
|
||||
data[:metrics] = {
|
||||
covered_percent: result.covered_percent,
|
||||
covered_strength: result.covered_strength,
|
||||
covered_strength: result.covered_strength.nan? ? 0.0 : result.covered_strength,
|
||||
covered_lines: result.covered_lines,
|
||||
total_lines: result.total_lines,
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user