Skip to content

Commit efbb147

Browse files
feat: add file path to xunit reporter (#4985)
* feat: add file path to xunit reporter * Update lib/reporters/xunit.js Co-authored-by: Ville Lahdenvuo <[email protected]> * Revert "Update lib/reporters/xunit.js" This reverts commit 1245e7e. --------- Co-authored-by: Ville Lahdenvuo <[email protected]>
1 parent a2e600d commit efbb147

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/reporters/xunit.js

+1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ XUnit.prototype.test = function (test) {
158158
var attrs = {
159159
classname: test.parent.fullTitle(),
160160
name: test.title,
161+
file: test.file,
161162
time: test.duration / 1000 || 0
162163
};
163164

test/reporters/xunit.spec.js

+11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('XUnit reporter', function () {
3030
var expectedLine = 'some-line';
3131
var expectedClassName = 'fullTitle';
3232
var expectedTitle = 'some title';
33+
var expectedFile = 'testFile.spec.js';
3334
var expectedMessage = 'some message';
3435
var expectedDiff =
3536
'\n + expected - actual\n\n -foo\n +bar\n ';
@@ -325,6 +326,7 @@ describe('XUnit reporter', function () {
325326
var expectedTest = {
326327
state: STATE_FAILED,
327328
title: expectedTitle,
329+
file: expectedFile,
328330
parent: {
329331
fullTitle: function () {
330332
return expectedClassName;
@@ -347,6 +349,8 @@ describe('XUnit reporter', function () {
347349
expectedClassName +
348350
'" name="' +
349351
expectedTitle +
352+
'" file="' +
353+
expectedFile +
350354
'" time="1"><failure>' +
351355
expectedMessage +
352356
'\n' +
@@ -365,6 +369,7 @@ describe('XUnit reporter', function () {
365369
var expectedTest = {
366370
state: STATE_FAILED,
367371
title: expectedTitle,
372+
file: expectedFile,
368373
parent: {
369374
fullTitle: function () {
370375
return expectedClassName;
@@ -402,6 +407,7 @@ describe('XUnit reporter', function () {
402407
return true;
403408
},
404409
title: expectedTitle,
410+
file: expectedFile,
405411
parent: {
406412
fullTitle: function () {
407413
return expectedClassName;
@@ -418,6 +424,8 @@ describe('XUnit reporter', function () {
418424
expectedClassName +
419425
'" name="' +
420426
expectedTitle +
427+
'" file="' +
428+
expectedFile +
421429
'" time="1"><skipped/></testcase>';
422430
expect(expectedWrite, 'to be', expectedTag);
423431
});
@@ -431,6 +439,7 @@ describe('XUnit reporter', function () {
431439
return false;
432440
},
433441
title: expectedTitle,
442+
file: expectedFile,
434443
parent: {
435444
fullTitle: function () {
436445
return expectedClassName;
@@ -447,6 +456,8 @@ describe('XUnit reporter', function () {
447456
expectedClassName +
448457
'" name="' +
449458
expectedTitle +
459+
'" file="' +
460+
expectedFile +
450461
'" time="0"/>';
451462
expect(expectedWrite, 'to be', expectedTag);
452463
});

0 commit comments

Comments
 (0)