mirror of
https://github.com/ditkrg/simplecov-json.git
synced 2026-01-23 06:16:45 +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,
|
filename: sourceFile.filename,
|
||||||
covered_percent: sourceFile.covered_percent,
|
covered_percent: sourceFile.covered_percent,
|
||||||
coverage: sourceFile.coverage,
|
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,
|
covered_lines: sourceFile.covered_lines.count,
|
||||||
lines_of_code: sourceFile.lines_of_code,
|
lines_of_code: sourceFile.lines_of_code,
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ class SimpleCov::Formatter::JSONFormatter
|
|||||||
data[:groups] = result.groups
|
data[:groups] = result.groups
|
||||||
data[:metrics] = {
|
data[:metrics] = {
|
||||||
covered_percent: result.covered_percent,
|
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,
|
covered_lines: result.covered_lines,
|
||||||
total_lines: result.total_lines,
|
total_lines: result.total_lines,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user