diff --git a/test/reporters/xunit.spec.js b/test/reporters/xunit.spec.js index a5e0f1bbeb..eb8104479d 100644 --- a/test/reporters/xunit.spec.js +++ b/test/reporters/xunit.spec.js @@ -357,6 +357,45 @@ describe('XUnit reporter', function () { expect(expectedWrite, 'to be', expectedTag); }); + it('should write valid XML', function () { + var xunit = new XUnit(runner); + var inputMessage = '\x1Bsome message'; + expectedMessage = '�some message'; + var expectedTest = { + state: STATE_FAILED, + title: expectedTitle, + parent: { + fullTitle: function () { + return expectedClassName; + } + }, + duration: 1000, + err: { + actual: 'foo', + expected: 'bar', + message: inputMessage, + stack: expectedStack + } + }; + + xunit.test.call(fakeThis, expectedTest); + sinon.restore(); + + var expectedTag = + '' + + expectedMessage + + '\n' + + expectedDiff + + '\n' + + expectedStack + + ''; + expect(expectedWrite, 'to be', expectedTag); + }); + it('should handle non-string diff values', function () { var runner = new EventEmitter(); createStatsCollector(runner);