Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What formatter to use for SimpleCov #5

Open
sigfrid opened this issue Feb 3, 2021 · 3 comments · May be fixed by #6
Open

What formatter to use for SimpleCov #5

sigfrid opened this issue Feb 3, 2021 · 3 comments · May be fixed by #6

Comments

@sigfrid
Copy link

sigfrid commented Feb 3, 2021

Hi there,
Thanks for creating this action.

Is there a specific formatter to use with SimpleCov?

I'm using the SimpleCov::Formatter::JSONFormatter which generates the following file

{
   "timestamp":1612347352,
   "command_name":"RSpec",
   "files":[
      {
         "filename":"/home/runner/work/alpha3/alpha3/app/dummy.rb",
         "covered_percent":71.42857142857143,
         "coverage":{
            "lines":[
               1,
               1,
               1,
               null,
               null,
               1,
               0,
               null,
               null,
               1,
               0,
               null,
               null
            ]
         },
         "covered_strength":0.7142857142857143,
         "covered_lines":5,
         "lines_of_code":7
      }
   ],
   "metrics":{
      "covered_percent":71.42857142857143,
      "covered_strength":0.7142857142857143,
      "covered_lines":5,
      "total_lines":7
   }
}

The file seems to have a different structure from the one expected by the action (https://github.com/devmasx/coverage-check-action/blob/master/lib/coverage_report.rb#L18)
Therefore, when I run it, I get

/action/lib/report_adapter.rb:10:in `conslusion': undefined method `>=' for nil:NilClass (NoMethodError)
	from /action/lib/github_check_run_service.rb:20:in `run'
	from /action/lib/index.rb:29:in `<main>'

Am I missing anything here?

Thanks,

@ericboehs
Copy link

I have this problem as well.

@ericboehs
Copy link

My .last_run.json looked like this:

{
  "result": {
    "line": 84.96
  }
}

I added this after my test commands to fix it:

sed -i 's/"line"/"covered_percent"/g' public/coverage/.last_run.json

@szechyjs
Copy link

This was the breaking change in simplecov simplecov-ruby/simplecov@542cd72

@szechyjs szechyjs linked a pull request Mar 30, 2021 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants