Skip to content

Instantly share code, notes, and snippets.

@danmayer
Created April 15, 2020 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danmayer/c9b1558c2ba535c80c0ed238332db82d to your computer and use it in GitHub Desktop.
Save danmayer/c9b1558c2ba535c80c0ed238332db82d to your computer and use it in GitHub Desktop.
Jruby Coverage Differences
# frozen_string_literal: true
class Dog
def bark
'woof'
end
end
# This is all related to trying to get Coverband to work for Jruby apps
# see https://github.com/danmayer/coverband/issues/361
require 'coverage'
Coverage.start
require './dog.rb'
puts Coverage.peek_result
puts "done"
bundle exec ruby test/jruby_check.rb
{"/Users/danmayer/projects/coverband/test/dog.rb"=>[nil, nil, 1, 1, 0, nil, nil]}
bundle exec ruby test/jruby_check.rb
test/jruby_check.rb:3: warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
{"/Users/danmayer/projects/coverband/test/dog.rb"=>[nil, nil, 0, 0, 0, nil, nil]}
> The above does not match MRI, becasue there are 0's where I would expect hits for parsing the methods...
bundle exec ruby --debug test/jruby_check.rb
{"/Users/danmayer/projects/coverband/test/dog.rb"=>[nil, nil, 1, 1, 0, nil, nil]}
> Now this matches, I can also get matching output with a `.jrubyrc` setting `debug.fullTrace=true`
ruby --version
jruby 9.2.9.0 (2.5.7) 2019-10-30 458ad3e OpenJDK 64-Bit Server VM 13.0.1+9 on 13.0.1+9 +jit [darwin-x86_64]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment