2

I am using Blanket.JS for code coverage and unfortunately it supports generating only lcov strings other than JSON and HTML. But I would like Jenkins to consume the same report but it seems it supports Cobertura.

I am looking for ways to convert this .lcov report to Cobertura XML. Currently this is the popular tool I have found so far http://eriwen.github.io/lcov-to-cobertura-xml/. But I am not ready to use it as it is Python dependent tool.

Someone please suggest me a way to convert lcov to Cobertura.

UndefinedN
  • 23
  • 4

1 Answers1

0

I was looking for an answer to this myself and could not find a way to do this. On the off chance it is helpful to others.

I am using Shippable for CI and it requires Cobertura XML and the framework I am using for testing hapijs/lab does not generate this format. So in my shippable.yml file;

before_install:
  - sudo apt-get install python2.7
  - git clone https://github.com/eriwen/lcov-to-cobertura-xml.git

script:
  - lab -r junit -o shippable/testresults/result.xml
  - lab -r lcov -o shippable/codecoverage/lcov.dat
  - python lcov-to-cobertura-xml/lcov_cobertura/lcov_cobertura.py shippable/codecoverage/lcov.dat --output shippable/codecoverage/coverage.xml

This worked for my purposes.

AndreJohn
  • 31
  • 5
  • how do you get lcov.dat? I'm using node js and istanbul/nyc, and the only file that looks vaguely similar is lcov.info... – rozza May 08 '19 at 14:25