Skip to content

Commit

Permalink
Show diff in xunit
Browse files Browse the repository at this point in the history
  • Loading branch information
mlucool authored Jun 26, 2018
1 parent f9c650c commit eacbb8c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/reporters/xunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ XUnit.prototype.write = function(line) {
* @param {Test} test
*/
XUnit.prototype.test = function(test) {
Base.useColors = false;

var attrs = {
classname: test.parent.fullTitle(),
name: test.title,
Expand All @@ -159,6 +161,9 @@ XUnit.prototype.test = function(test) {

if (test.state === 'failed') {
var err = test.err;
var diff = base.hideDiff
? ''
: '\n' + Base.generateDiff(err.actual, err.expected);
this.write(
tag(
'testcase',
Expand All @@ -168,7 +173,7 @@ XUnit.prototype.test = function(test) {
'failure',
{},
false,
escape(err.message) + '\n' + escape(err.stack)
escape(err.message) + escape(diff) + '\n' + escape(err.stack)
)
)
);
Expand Down

0 comments on commit eacbb8c

Please sign in to comment.