Bug 1252995 - recordTestCoverage modification. r=chmanchester

This is a modification to recordTestCoverage. It now gathers methods and the lines each span, uncovered lines, and now also places a version control block at the beginning of every artifact.

MozReview-Commit-ID: LbpnDqheYpy
This commit is contained in:
Greg Mierzwinski 2016-03-11 19:21:36 -05:00
parent 814949873d
commit e24e9fdcd6

View File

@ -165,16 +165,33 @@ CoverageCollector.prototype._getMethodNames = function() {
CoverageCollector.prototype.recordTestCoverage = function (testName) {
dump("Collecting coverage for: " + testName + "\n");
let rawLines = this._getLinesCovered(testName);
let methods = this._getMethodNames();
let uncoveredLines = this._getUncoveredLines();
let result = [];
let versionControlBlock = {version: 1.0};
result.push(versionControlBlock);
for (let scriptName in rawLines) {
let rec = {
testUrl: testName,
sourceFile: scriptName,
covered: []
methods: {},
covered: [],
uncovered: []
};
for (let methodName in methods[scriptName]){
rec.methods[methodName] = methods[scriptName][methodName];
}
for (let line of rawLines[scriptName]) {
rec.covered.push(line);
}
for (let line of uncoveredLines[scriptName]){
rec.uncovered.push(line);
}
result.push(rec);
}
let arr = this._encoder.encode(JSON.stringify(result, null, 2));