JSCover icon indicating copy to clipboard operation
JSCover copied to clipboard

can u add line and branch coverage data to class attribute

Open kathxqq opened this issue 4 years ago • 4 comments

As for our project , we need more detail coverage data about every js file, so can you add the following info to classElement.

        classElement.setAttribute("lines-covered", "" + file.getCodeLinesCoveredCount());
        classElement.setAttribute("lines-valid", "" + file.getCodeLineCount());
        classElement.setAttribute("branchs-covered", "" + file.getBranchesCoveredCount());
        classElement.setAttribute("branchs-valid", "" + file.getBranchCount());

we will be very appreciate , if you add this. thank you very much !

image

After added , the following xml is what we want image

kathxqq avatar Sep 24 '20 09:09 kathxqq

That looks doable...let me take a look.

tntim96 avatar Sep 26 '20 05:09 tntim96

Unfortunately that would break the DTD.

  <!ELEMENT class (methods,lines)>
  <!ATTLIST class name        CDATA #REQUIRED>
  <!ATTLIST class filename    CDATA #REQUIRED>
  <!ATTLIST class line-rate   CDATA #REQUIRED>
  <!ATTLIST class branch-rate CDATA #REQUIRED>
  <!ATTLIST class complexity  CDATA #REQUIRED>

I'd prefer to add support for another format that does do this. Does the JaCoCo XML format support what you want and is it usable by you.

tntim96 avatar Sep 26 '20 06:09 tntim96

I'd prefer to add support for another format that does do this. Does the JaCoCo XML format support what you want and is it usable by you.

that's preety good , the jacoco xml format can satisfy our demands. thank you very much~

kathxqq avatar Sep 27 '20 01:09 kathxqq

I've created a branch for developing this. It will probably take a week or so. I've marked it as a good first issue in case anyone wants to help. It should be a fairly straight forward addition working off the Cobertura XML code as a template.

tntim96 avatar Sep 27 '20 04:09 tntim96