Skip to content

Instantly share code, notes, and snippets.

@Kami
Created April 28, 2011 17:45
Show Gist options
  • Select an option

  • Save Kami/946847 to your computer and use it in GitHub Desktop.

Select an option

Save Kami/946847 to your computer and use it in GitHub Desktop.
function stringifyCoverage(_jscoverage) {
var i, file, fileObj, fileLines;
var coverageObj = {};
files = Object.keys(_jscoverage);
for (i = 0; i < files.length; i++) {
file = files[i];
fileObj = _jscoverage[file];
source = fileObj['source'];
delete fileObj['source'];
fileLines = Object.keys(fileObj);
coverageObj[file] = {
'lines': fileLines,
'source': source
};
}
return JSON.stringify(coverageObj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment