Git Product home page Git Product logo

jacoco-parse's Introduction

jacoco-parse

Parse jacoco results file and return JSON

The output is based on, and intended to be compatible with, https://github.com/davglass/lcov-parse as well as https://github.com/vokal/cobertura-parse

Use

var jacoco = require( "jacoco-parse" );

// parse by file path
jacoco.parseFile( "filepath.xml", function( err, result ) { ... } );

// or parse file contents
jacoco.parseContent( "<?xml version="1.0" ?><report>...</report>",
    function( err, result ) { ... } );

jacoco-parse's People

Contributors

wmbest2 avatar tathanen avatar jrit avatar marklagendijk avatar eduramiba avatar

Stargazers

Kirill Shmakov avatar wangxinkai avatar Simon Dann avatar  avatar Gabriel Csapo avatar  avatar Michael Myers avatar

Watchers

Scott Ferguson avatar  avatar James Cloos avatar  avatar Alex Nimmer avatar Chris Dadabo avatar TJ Soptame avatar Adam Bain avatar Jose Garcia avatar Steve J. avatar  avatar

jacoco-parse's Issues

Support Branches

Currently only function counts and line counts are supported. This should support branch data as well.

Support jacoco.xml sourcefiles that don't have branches information

For example this file produces:

    <class name="net/uniform/html/renderers/HiddenRenderer">
      <method desc="()V" line="31" name="&lt;init&gt;">
        <counter covered="3" missed="0" type="INSTRUCTION"/>
        <counter covered="1" missed="0" type="LINE"/>
        <counter covered="1" missed="0" type="COMPLEXITY"/>
        <counter covered="1" missed="0" type="METHOD"/>
      </method>
      <method desc="(Lnet/uniform/html/elements/Hidden;)Ljava/util/List;" line="35" name="render">
        <counter covered="35" missed="0" type="INSTRUCTION"/>
        <counter covered="8" missed="0" type="LINE"/>
        <counter covered="1" missed="0" type="COMPLEXITY"/>
        <counter covered="1" missed="0" type="METHOD"/>
      </method>
      <counter covered="38" missed="0" type="INSTRUCTION"/>
      <counter covered="9" missed="0" type="LINE"/>
      <counter covered="2" missed="0" type="COMPLEXITY"/>
      <counter covered="2" missed="0" type="METHOD"/>
      <counter covered="1" missed="0" type="CLASS"/>
    </class>

The produced exception is:

Uncaught TypeError: Cannot read property '$' of undefined
      at node_modules/jacoco-parse/source/index.js:68:44
      at Array.map (native)
      at node_modules/jacoco-parse/source/index.js:23:35
      at Array.forEach (native)
      at unpackage (node_modules/jacoco-parse/source/index.js:21:14)
      at node_modules/jacoco-parse/source/index.js:114:22
      at Parser.<anonymous> (node_modules/xml2js/lib/xml2js.js:489:18)
      at Object.onclosetag (node_modules/xml2js/lib/xml2js.js:447:26)
      at emit (node_modules/sax/lib/sax.js:640:35)
      at emitNode (node_modules/sax/lib/sax.js:645:5)
      at closeTag (node_modules/sax/lib/sax.js:905:7)
      at Object.write (node_modules/sax/lib/sax.js:1452:13)
      at Parser.exports.Parser.Parser.parseString (node_modules/xml2js/lib/xml2js.js:508:31)
      at Parser.parseString (node_modules/xml2js/lib/xml2js.js:7:59)
      at exports.parseString (node_modules/xml2js/lib/xml2js.js:540:19)
      at Object.parse.parseContent (node_modules/jacoco-parse/source/index.js:107:5)
      at node_modules/jacoco-parse/source/index.js:129:15
      at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.