grunt-mincover v0.0.7
grunt-mincover
Grunt task to ensure minimum code coverage with auto-update of minimum coverage requirements as coverage increases.
Setup
Add the following to your grunt file:
mincover: {
reporterType: 'cobertura',
reportPath: 'test/coverage/reports/cobertura-coverage.xml',
updateCoverageMins: true
}
Run grunt mincover
to create the .mincover file with initial coverage values. The coberture coverage xml file must exist in order for the .mincover file to be created.
Usage
Make sure you have generated your coverage files and then run grunt mincover
Options
reporterType
String - The type of coverage report.
- cobertura - curently the only supported value
reportPath
String - The path to the report file
- Examples
- 'target/site/cobertura/coverage.xml'
- 'test/coverage/reports/cobertura-coverage.xml'
updateCoverageMins
Boolean - Should the .mincover file be updated with the most recent code coverage levels if they are higher than what was previously set.
- true
- The .mincover file will be updated on each run of
grunt mincover
as the coverage increases. The file will be created if it does not exist unless the coverage file cannot be loaded.
- The .mincover file will be updated on each run of
- false
- The .mincover file will be read but not updated. If the .mincover file does not exist then the task will fail.
.mincover file
The .mincover file must be located in the same directory as Gruntfile.js. If updateCoverageMins is true then the file will be created the first time grunt mincover
is run with a valid coverage file generated by the selected reporter type (cobertura, for example). The .mincover file can be created manually with custom values by using the following format:
{
"minimumRequiredCoverage": {
"branches": 44,
"lines": 82
}
}
Coverage values are integers. If updateCoverageMins is set to false then coverage levels lower than the values set in .mincover will cause the job to fail but .mincover will not be updated.