Skip to content

Commit

Permalink
Added more details to the junit parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Merrifield, Jay committed Jun 4, 2014
1 parent 5dd84b2 commit be20248
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/Reporter.js
Expand Up @@ -20,9 +20,9 @@ function Reporter(lines, ruleset){
/**
* List of statistics being reported.
* @property stats
* @type String[]
* @type Object
*/
this.stats = [];
this.stats = {};

/**
* Lines of code being reported on. Used to provide contextual information
Expand Down
14 changes: 12 additions & 2 deletions src/formatters/junit-xml.js
Expand Up @@ -32,6 +32,8 @@ CSSLint.addFormatter({
"use strict";

var messages = results.messages,
statKeys = Object.keys(results.stats),
numTests = results.stats["rule-count"] || messages.length,
output = [],
tests = {
"error": 0,
Expand Down Expand Up @@ -96,11 +98,19 @@ CSSLint.addFormatter({

});

output.unshift("<testsuite time=\"0\" tests=\"" + messages.length + "\" skipped=\"0\" errors=\"" + tests.error + "\" failures=\"" + tests.failure + "\" package=\"net.csslint\" name=\"" + filename + "\">");
output.push("</testsuite>");
}

if (statKeys.length > 0) {
output.push("<properties>");
statKeys.forEach(function(key) {
output.push("<property name=\"" + key + "\" value=\"" + results.stats[key] + "\"/>");
});
output.push("</properties>");
}

output.unshift("<testsuite time=\"0\" tests=\"" + numTests + "\" skipped=\"0\" errors=\"" + tests.error + "\" failures=\"" + tests.failure + "\" package=\"net.csslint\" name=\"" + filename + "\">");
output.push("</testsuite>");

return output.join("");

}
Expand Down

0 comments on commit be20248

Please sign in to comment.