Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added CDATA wrapper to evidence output for JUNIT formatter

  • Loading branch information...
commit b2a684bde6598b9ef2a6f140e605402d26320c02 1 parent a123413
indieisaconcept authored
Showing with 5 additions and 5 deletions.
  1. +1 −1  src/formatters/junit-xml.js
  2. +4 −4 tests/formatters/junit-xml.js
View
2  src/formatters/junit-xml.js
@@ -85,7 +85,7 @@ CSSLint.addFormatter({
// build the test case seperately, once joined
// we'll add it to a custom array filtered by type
output.push("<testcase time=\"0\" name=\"" + generateSource(message.rule) + "\">");
- output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\">" + message.line + ':' + message.col + ':' + escapeSpecialCharacters(message.evidence) + "</" + type + ">");
+ output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\"><![CDATA[" + message.line + ':' + message.col + ':' + escapeSpecialCharacters(message.evidence) + "]]></" + type + ">");
output.push("</testcase>");
tests[type] += 1;
View
8 tests/formatters/junit-xml.js
@@ -23,8 +23,8 @@
], stats: [] },
file = "<testsuite time=\"0\" tests=\"2\" skipped=\"0\" errors=\"2\" failures=\"0\" package=\"net.csslint\" name=\"FILE\">",
- error1 = "<testcase time=\"0\" name=\"net.csslint.ARule\"><error message=\"BOGUS\">1:1:ALSO BOGUS</error></testcase>",
- error2 = "<testcase time=\"0\" name=\"net.csslint.SomeOtherRule\"><error message=\"BOGUS\">2:1:ALSO BOGUS</error></testcase>",
+ error1 = "<testcase time=\"0\" name=\"net.csslint.ARule\"><error message=\"BOGUS\"><![CDATA[1:1:ALSO BOGUS]]></error></testcase>",
+ error2 = "<testcase time=\"0\" name=\"net.csslint.SomeOtherRule\"><error message=\"BOGUS\"><![CDATA[2:1:ALSO BOGUS]]></error></testcase>",
expected = "<?xml version=\"1.0\" encoding=\"utf-8\"?><testsuites>" + file + error1 + error2 + "</testsuite></testsuites>",
actual = CSSLint.format(result, "FILE", "junit-xml");
@@ -41,8 +41,8 @@
], stats: [] },
file = "<testsuite time=\"0\" tests=\"2\" skipped=\"0\" errors=\"2\" failures=\"0\" package=\"net.csslint\" name=\"FILE\">",
- error1 = "<testcase time=\"0\" name=\"\"><error message=\"sneaky, 'sneaky', &lt;sneaky&gt;\">1:1:ALSO BOGUS</error></testcase>",
- error2 = "<testcase time=\"0\" name=\"\"><error message=\"sneaky, 'sneaky', &lt;sneaky&gt;\">2:1:ALSO BOGUS</error></testcase>",
+ error1 = "<testcase time=\"0\" name=\"\"><error message=\"sneaky, 'sneaky', &lt;sneaky&gt;\"><![CDATA[1:1:ALSO BOGUS]]></error></testcase>",
+ error2 = "<testcase time=\"0\" name=\"\"><error message=\"sneaky, 'sneaky', &lt;sneaky&gt;\"><![CDATA[2:1:ALSO BOGUS]]></error></testcase>",
expected = "<?xml version=\"1.0\" encoding=\"utf-8\"?><testsuites>" + file + error1 + error2 + "</testsuite></testsuites>",
actual = CSSLint.format(result, "FILE", "junit-xml");
Please sign in to comment.
Something went wrong with that request. Please try again.