Trying to add simplecov to my Rails app (Jruby 1.6.4, Ruby 1.9.2, Windows). I added ‘simplecov’ to the Gemfile, bundle install, and the following to the top of my spec_helper:
require 'rubygems'
require 'simplecov'
SimpleCov.start 'rails'
When run I get the following exception:
$ bundle exec rspec --debug spec
No DRb server is running. Running in local process instead ...
c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.4-java/lib/ruby-debug-base.rb:214 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-0.5.4/lib/simplecov.rb:33 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
LoadError: load error: rails/railtie -- java.lang.NegativeArraySizeException: null
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/engine.rb:1
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/engine.rb:1
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/plugin.rb:4
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/application.rb:10
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails.rb:1
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/actionpack-3.1.0/lib/action_controller/railtie.rb:5
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/railsProjects/txprepaid/config/application.rb:2
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/railsProjects/txprepaid/config/environment.rb:13
require at org/jruby/RubyKernel.java:1047
(root) at c:/dev/railsProjects/txprepaid/spec/spec_helper.rb:1
load at org/jruby/RubyKernel.java:1073
load_spec_files at c:/dev/railsProjects/txprepaid/spec/controllers/dictionary_controller_spec.rb:459
collect at org/jruby/RubyArray.java:2344
load_spec_files at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459
run at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18
run_in_process at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80
run at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:66
autorun at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10
ArgumentError: same file: c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-html-0.5.3/lib/../assets/app.js and C:/dev/railsProjects/txprepaid/coverage/assets/0.5.3/app.js
fu_each_src_dest at c:/dev/apps/jruby-1.6.4/lib/ruby/1.9/fileutils.rb:1417
fu_each_src_dest0 at c:/dev/apps/jruby-1.6.4/lib/ruby/1.9/fileutils.rb:1432
fu_each_src_dest at c:/dev/apps/jruby-1.6.4/lib/ruby/1.9/fileutils.rb:1416
cp_r at c:/dev/apps/jruby-1.6.4/lib/ruby/1.9/fileutils.rb:432
format at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-html-0.5.3/lib/simplecov-html.rb:15
each at org/jruby/RubyArray.java:1603
format at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-html-0.5.3/lib/simplecov-html.rb:14
format! at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-0.5.4/lib/simplecov/result.rb:90
at_exit at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-0.5.4/lib/simplecov/configuration.rb:133
call at org/jruby/RubyProc.java:262
(root) at c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-0.5.4/lib/simplecov/defaults.rb:47
It would look like not all the support for coverage support is available in JRuby as can be seen in the links below, this is probably affecting simplecov as it relies on the in built coverage functionality that is expected in Ruby 1.9.
https://github.com/colszowka/simplecov/issues/86
http://jira.codehaus.org/browse/JRUBY-6106
http://jira.codehaus.org/browse/JRUBY-5935