CoverageFormat.js revision 5aab19b8b78189ce79cf89283f2d505566d4e6a8
/**
* An object object containing coverage result formatting methods.
* @namespace Test
* @class CoverageFormat
* @static
*/
Test.CoverageFormat = {
/**
* Returns the coverage report in JSON format. This is the straight
* JSON representation of the native coverage report.
* @param {Object} coverage The coverage report object.
* @return {String} A JSON-formatted string of coverage data.
* @method JSON
* @namespace Test.CoverageFormat
*/
JSON: function(coverage){
return Test.Util.JSON.stringify(coverage);
},
/**
* Returns the coverage report in a JSON format compatible with
* Xdebug. See <a href="http://www.xdebug.com/docs/code_coverage">Xdebug Documentation</a>
* for more information. Note: function coverage is not available
* in this format.
* @param {Object} coverage The coverage report object.
* @return {String} A JSON-formatted string of coverage data.
* @method XdebugJSON
* @namespace Test.CoverageFormat
*/
XdebugJSON: function(coverage){
var report = {};
for (var prop in coverage){
if (coverage.hasOwnProperty(prop)){
report[prop] = coverage[prop].lines;
}
}
return Test.Util.JSON.stringify(coverage);
}
};