2

I have a suspicion that this is a local system configuration issue, but I don't know exactly what I'm doing wrong. In my spec_helper.rb file, I have the following lines at the very beginning:

require 'simplecov'
SimpleCov.start 'rails'

I can run the following locally on the command line (which is exactly what RubyMine is running):

/home/scottj/.rvm/rubies/ruby-2.6.1/bin/ruby -x /home/scottj/Source/foamfactory/api/bin/bundle exec /home/scottj/.rvm/rubies/ruby-2.6.1/bin/ruby -r /home/scottj/.local/share/JetBrains/Toolbox/apps/RubyMine/ch-0/221.5787.34/plugins/ruby/rb/simplecov_starter.rb /home/scottj/Source/foamfactory/api/bin/rails spec

And it will generate a report in coverage/index.html that appears to be correct. However, when I run api: spec with coverage in RubyMine, all of my files in the app/ directory show up as "0% coverage". I suspect this has something to do with a simplecov_json_formatter that appears to be installed within my system gems folder, but I'm not sure.

Can anyone help with configuration so I can get back to a stable state where I can see code coverage in RubyMine?

jwir3
  • 6,019
  • 5
  • 47
  • 92
  • have you looked through this: https://www.jetbrains.com/help/ruby/code-coverage.html#run_with_coverage – engineersmnky Sep 12 '22 at 17:33
  • @engineersmnky Thanks, but, yes. I think it has something to do with pointing to the incorrect file(s) for coverage. I can see the `index.html` report being generated, along with some .json files that look correct, but RubyMine simply isn't showing the coverage in the IDE. – jwir3 Sep 13 '22 at 13:49

1 Answers1

0

I was sort of able to fix this by comparing with one of my other projects that had code coverage working successfully. What I did was remove the "spec: API" configuration that was a rake task configuration, add a new run/debug configuration of "RSpec" type and called it "Run All Specs", with the spec folder as the input folder.

Now, running with code coverage works as expected. It would be really interesting to understand why, though.

jwir3
  • 6,019
  • 5
  • 47
  • 92