Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Fix fragile xunit reporter spec

Daniel St. Julesd7e4605c69f2
diff --git a/test/integration/reporters.js b/test/integration/reporters.js
index c29fccca..19cf0bdd 100644
--- a/test/integration/reporters.js
+++ b/test/integration/reporters.js
@@ -41,10 +41,10 @@ describe('reporters', function() {
var args = ['--reporter=xunit', '--reporter-options', 'output=' + tmpFile];
var expectedOutput = [
- '<testcase classname="suite" name="test1" time="0"/>',
- '<testcase classname="suite" name="test2" time="0"/>',
+ '<testcase classname="suite" name="test1" time="',
+ '<testcase classname="suite" name="test2" time="',
'</testsuite>'
- ].join('\n');
+ ];
run('passing.js', args, function(err, result) {
if (err) return done(err);
@@ -52,7 +52,10 @@ describe('reporters', function() {
var xml = fs.readFileSync(tmpFile, 'utf8');
fs.unlinkSync(tmpFile);
- assert(xml.indexOf(expectedOutput) !== -1, 'Did not output all xml');
+ expectedOutput.forEach(function(line) {
+ assert(xml.indexOf(line) !== -1, 'XML did not contain ' + line);
+ });
+
done(err);
});
});