☕️ Classic, reliable, trusted test framework for Node.js and the browser
Avoid double and triple xUnit XML escaping (#2178)
Thomas Grainger49b5ff1508dd
diff --git a/lib/reporters/xunit.js b/lib/reporters/xunit.jsindex 875d5928..1cfd8f4f 100644--- a/lib/reporters/xunit.js+++ b/lib/reporters/xunit.js@@ -130,7 +130,7 @@ XUnit.prototype.test = function(test) {if (test.state === 'failed') {var err = test.err;- this.write(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + '\n' + err.stack))));+ this.write(tag('testcase', attrs, false, tag('failure', {}, false, escape(err.message) + '\n' + escape(err.stack))));} else if (test.isPending()) {this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));} else {@@ -164,11 +164,3 @@ function tag(name, attrs, close, content) {}return tag;}--/**- * Return cdata escaped CDATA `str`.- */--function cdata(str) {- return '<![CDATA[' + escape(str) + ']]>';-}