format-coverage fails for simplecov 0.21.2 (minitest) with cc-test-reporter 0.10.3 #495
Open
Description
What happens
cc-test-reporter format-coverage
fails with coverage results from SimpleCov 0.21.2 and minitest 5.16.1 as follows:
$ ./cc-test-reporter format-coverage -t simplecov coverage/.resultset.json -d
DEBU[0000] coverage path coverage/.resultset.json
DEBU[0000] using formatter simplecov
DEBU[0000] checking search path coverage/.resultset.json for simplecov formatter
DEBU[0000] couldn't load branch from ENV, trying git...
DEBU[0000] couldn't load commit sha from ENV, trying git...
DEBU[0000] couldn't load committed at from ENV, trying git...
DEBU[0000] Analyzing simplecov json output from latest format coverage/.resultset.json
DEBU[0000] Analyzing simplecov json output from legacy format coverage/.resultset.json
Error: json: cannot unmarshal object into Go struct field resultSet.coverage of type []formatters.NullInt
Why
The following results should be handled without any error:
{
"Unit Tests": {
"coverage": {
"/workspace/geminabox/lib/geminabox.rb": {
"lines": [
null
]
},
"/workspace/geminabox/lib/geminabox/proxy.rb": {
"lines": [
null
]
}
},
"timestamp": 1650000000
},
"Integration Tests": {
"coverage": {
"/workspace/geminabox/lib/geminabox.rb": {
"lines": [
null
]
},
"/workspace/geminabox/lib/geminabox/proxy.rb": {
"lines": [
null
]
}
},
"timestamp": 1650000000
}
}
Currently it work well with the following results:
{
"Unit Tests": {
"coverage": {
"/workspace/geminabox/lib/geminabox.rb": [
null
],
"/workspace/geminabox/lib/geminabox/proxy.rb": [
null
]
},
"timestamp": 1650000000
},
"Integration Tests": {
"coverage": {
"/workspace/geminabox/lib/geminabox.rb": [
null
],
"/workspace/geminabox/lib/geminabox/proxy.rb": [
null
]
},
"timestamp": 1650000000
}
}
Workaround
jq 'map_values(. | map_values(if type=="object" then map_values(.lines) else . end))' coverage/.resultset.json
helped me work well.
Environments
Code Climate Test Reporter 0.10.3 (2cd3a82f34475dd7387da166ddd967fe1d713a65 @ 2022-02-15T15:28:53+0000)
- simplecov (0.21.2)
- simplecov_json_formatter (0.1.4)
- minitest (5.16.1)
- Send coverage report to CodeClimate geminabox/geminabox#475
Metadata
Assignees
Labels
No labels