Skip to content

Commit

Permalink
[7.x] [junit] only include stdout in report for failures (#605… (#60590)
Browse files Browse the repository at this point in the history
* [junit] only include stdout in report for failures

* fix assertion

Co-authored-by: spalger <spalger@users.noreply.github.com>

Co-authored-by: spalger <spalger@users.noreply.github.com>
  • Loading branch information
Spencer and spalger authored Mar 19, 2020
1 parent 459cb8a commit f056b1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dev/mocha/__tests__/junit_report_generation.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('dev/mocha/junit report generation', () => {
name: 'SUITE SUB_SUITE never runs',
'metadata-json': '{}',
},
'system-out': testFail['system-out'],
'system-out': ['-- logs are only reported for failed tests --'],
skipped: [''],
});
});
Expand Down
4 changes: 3 additions & 1 deletion src/dev/mocha/junit_report_generation.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,15 @@ export function setupJUnitReportGeneration(runner, options = {}) {

[...results, ...skippedResults].forEach(result => {
const el = addTestcaseEl(result.node);
el.ele('system-out').dat(escapeCdata(getSnapshotOfRunnableLogs(result.node) || ''));

if (result.failed) {
el.ele('system-out').dat(escapeCdata(getSnapshotOfRunnableLogs(result.node) || ''));
el.ele('failure').dat(escapeCdata(inspect(result.error)));
return;
}

el.ele('system-out').dat('-- logs are only reported for failed tests --');

if (result.skipped) {
el.ele('skipped');
}
Expand Down

0 comments on commit f056b1a

Please sign in to comment.