☕️ Classic, reliable, trusted test framework for Node.js and the browser
cleaning up xunit reporter some more
TJ Holowaychuk186dfcd53efe
diff --git a/lib/reporters/xunit.js b/lib/reporters/xunit.jsindex eb2abeb1..17db235a 100644--- a/lib/reporters/xunit.js+++ b/lib/reporters/xunit.js@@ -42,7 +42,7 @@ function XUnit(runner) {tests.forEach(test);- console.error(end('testsuite'));+ console.error('</testsuite>');});}@@ -74,23 +74,24 @@ function test(test) {}}-function tag(name, attrs, single, content) {- var tag;- var end = single ? ' />' : '>'- var strAttr = [];- for (var attr in attrs) {- attrs.hasOwnProperty(attr) && strAttr.push(attr + '="' + escape(attrs[attr]) + '"');+/**+ * HTML tag helper.+ */++function tag(name, attrs, close, content) {+ var end = close ? '/>' : '>'+ , pairs = []+ , tag;++ for (var key in attrs) {+ pairs.push(key + '="' + escape(attrs[key]) + '"');}- tag = '<' + name + (strAttr.length? ' ' + strAttr.join(' ') : '' ) + end;- tag = content? (tag + content + '</' + name + end) : tag;+ tag = '<' + name + (pairs.length? ' ' + pairs.join(' ') : '') + end;+ if (content) tag += content + '</' + name + end;return tag;}-function end(name) {- return '</' + name + '>';-}-/*** Return cdata escaped CDATA `str`.*/