Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Latest commit

 

History

History
36 lines (28 loc) · 909 Bytes

README.md

File metadata and controls

36 lines (28 loc) · 909 Bytes

Mocha reporter for SonarQube General test coverage

This reporter outputs the coverage report using the XML format for the SonarQube General Test Coverage plugin https://docs.sonarqube.org/display/PLUG/Generic+Test+Coverage

https://github.com/visionmedia/mocha/wiki/Third-party-reporters describes using third party reporters in mocha.

Basically, have your project's package.json be like:

{  
  "devDependencies": {  
    "mocha-sonar-xml-cov-reporter": ">=0.0.1"  
  }  
}

Then call mocha with:

mocha --reporter mocha-sonar-xml-reporter test

This also works well with grunt-mocha-test

mochaTest: {  
  test: {  
    // Your test settings  
  },  
  coverage: {  
    options: {  
      reporter: 'mocha-sonar-xml-cov-reporter',  
      quiet: false  
    },  
    src: ['src/files.js']  // Your source code files  
  }  
}