REXML Error when running rcov

Rcov is one of the tools we use at eSpace to measure automated tests coverage for our rails applications.

By rcov through gem install rcov, I had rcov(0.8.1.2.0) installed.

After upgrading to the latest ubuntu 8.10, I realized that the installed rcov is not compatible with ruby 1.8.7 that i have. Rcov failed at generating the html reports with this stacktrace

/usr/lib/ruby/1.8/rexml/formatters/pretty.rb:131:in `[]': no implicit conversion from nil to integer (TypeError)
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:131:in `wrap'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:131:in `wrap'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:90:in `write_text'
    from /usr/lib/ruby/1.8/rexml/formatters/default.rb:50:in `write'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:75:in `write_element'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:73:in `each'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:73:in `write_element'
    from /usr/lib/ruby/1.8/rexml/formatters/default.rb:31:in `write'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:75:in `write_element'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:73:in `each'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:73:in `write_element'
    from /usr/lib/ruby/1.8/rexml/formatters/default.rb:31:in `write'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:117:in `write_document'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:111:in `each'
    from /usr/lib/ruby/1.8/rexml/formatters/pretty.rb:111:in `write_document'
    from /usr/lib/ruby/1.8/rexml/formatters/default.rb:28:in `write'
    from /usr/lib/ruby/1.8/rexml/document.rb:197:in `write'
    from (eval):93:in `pretty'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov/report.rb:1003:in `create_file'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov/report.rb:708:in `execute'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov/report.rb:125:in `each'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov/report.rb:125:in `each_file_pair_sorted'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov/report.rb:707:in `execute'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov.rb:640:in `dump_coverage_info'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov.rb:640:in `each'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov.rb:640:in `dump_coverage_info'
    from /usr/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/bin/rcov:421
    from /usr/lib/ruby/1.8/test/unit.rb:278

Luckily Mauricio Fernandez has provided a new version of rcov to solve this issue. It can be downloaded from his github repo or simply:

git clone git://github.com/spicycode/rcov.git
ruby setup.rb

This will install the latest rcov 0.8.1.5 that will work fine

Comments

Popular posts from this blog

Success of Startups

Prime Numbers Generator

Android Marshmallow highlights