Domanda

I have a project I want to get code coverage on. It's just a standard JRuby project not on Rails and I was wondering how to get RCov to work. I have been trying for a long time to get results and I just don't know whats going on. I get a coverage folder to get displayed but all the files either get loaderrors on requires or the files that get loaded just don't say they've been tested at all (which I know in one case is balooney since I made a test spec for it). Can anyone explain to me how to get RCov to work or why I am getting the attached error? I don't understand how/why you are supposed to do a -I for included libraries or what the point of that is. From what I've been doing so far I have been just running rcov spec/.rb from my main appcode directory and that generates my coverage folder and : rcov spec/.rb /home/ben/.rvm/gems/jruby-1.6.8/gems/rcov-0.9.11-java/lib/rcov/differential_analyzer.rb:31 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag NoMethodError: undefined method `describe' for main:Object (root) at ./spec/ncrf_spec.rb:3

È stato utile?

Soluzione

RCov is strictly limited to Matz's reference implemenation of Ruby (MRI) 1.8.x and doesn't even work on MRI 1.9.x.

SimpleCov is the new way to go, as it uses the new Ruby Coverage API. This API for a while was not supported by JRuby, or at least not to an extent that it was usable in production. The original issue on SimpleCov's bugtracker doesn't state explicitly that it works now. However, the issue they files in the JRuby tracker about this Ruby Coverage API not working correctly states that this issue is now resolved.

I guess you should try your luck with the latest versions of both JRuby and SimpleCov.

On the other topic:

Ruby's -I flag adds directories to the $LOAD_PATH array which defines the locations in which .rb files are searched when you try to load them with require. As of Ruby 1.9.x files can only be found when they are in one of the directories in $LOAD_PATH and are no longer also found relative to the current working directory of your Ruby process.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top