Generate cobertura-xml report with mocha

Using mocha-cobertura-reporter module.

$ npm install mocha-cobertura-reporter

$ XXX_COV=1 ./node_modules/.bin/mocha --reporter mocha-cobertura-reporter > cobertura.xml

covertura.xml contents

<coverage branch-rate="0" line-rate="1" timestamp="1359942445859" version="3.5.1">
  <packages>
    <package branch-rate="0" complexity="0.0" line-rate="1" name=".">
      <classes>
        <class branch-rate="0" complexity="0.0" filename="utility.js" line-rate="1" name="utility">
          <methods/>
          <lines>
            <line hits="" number="1"/>
            <line hits="" number="2"/>
            <line hits="" number="3"/>
            // ....
            <line hits="" number="82"/>
            <line hits="" number="83"/>
            <line hits="" number="84"/>
          </lines>
        </class>
      </classes>
    </package>
  </packages>
</coverage>

Comments

Fork me on GitHub