Skip to content

Commit

Permalink
Resolve undefined property lookup on mocha file name formatting
Browse files Browse the repository at this point in the history
Should help resolve issue: michaelleeallen#178
  • Loading branch information
zjkipping committed Jun 14, 2023
1 parent 4b17772 commit 1b568d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,10 @@ MochaJUnitReporter.prototype.formatReportFilename = function(xml, testsuites) {
reportFilename = reportFilename.replace('[rootSuiteTitle]', this._options.rootSuiteTitle);
}
if (reportFilename.indexOf('[suiteFilename]') !== -1) {
reportFilename = reportFilename.replace('[suiteFilename]', testsuites[0].testsuite[0]._attr.file);
reportFilename = reportFilename.replace('[suiteFilename]', testsuites[0]?.testsuite[0]?._attr.file ?? '');
}
if (reportFilename.indexOf('[suiteName]') !== -1) {
reportFilename = reportFilename.replace('[suiteName]', testsuites[1].testsuite[0]._attr.name);
reportFilename = reportFilename.replace('[suiteName]', testsuites[1]?.testsuite[0]?._attr.name ?? '');
}

return reportFilename;
Expand Down

0 comments on commit 1b568d0

Please sign in to comment.