Skip to content

Commit

Permalink
Report top suite name as "top suite", not "undefined"
Browse files Browse the repository at this point in the history
  • Loading branch information
sgravrock committed Oct 12, 2021
1 parent 18098bf commit 6b3c747
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/reporters/console_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function ConsoleReporter() {
}

if (result && result.failedExpectations && result.failedExpectations.length > 0) {
suiteFailureDetails(result);
suiteFailureDetails({ fullName: 'top suite', ...result });
}

if (pendingSpecs.length > 0) {
Expand Down
18 changes: 12 additions & 6 deletions spec/reporters/console_reporter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,16 +551,22 @@ describe("ConsoleReporter", function() {
const reporter = new ConsoleReporter();
reporter.setOptions({
print: this.out.print,
showColors: true
showColors: false
});

reporter.suiteDone({ failedExpectations: [{ message: 'After All Exception' }] });
reporter.suiteDone({ failedExpectations: [{ message: 'Some Other Exception' }] });
reporter.suiteDone({
fullName: 'suite 1',
failedExpectations: [{ message: 'After All Exception' }]
});
reporter.suiteDone({
fullName: 'suite 2',
failedExpectations: [{ message: 'Some Other Exception' }]
});
reporter.jasmineDone({ failedExpectations: [{ message: 'Global Exception' }] });

expect(this.out.getOutput()).toMatch(/After All Exception/);
expect(this.out.getOutput()).toMatch(/Some Other Exception/);
expect(this.out.getOutput()).toMatch(/Global Exception/);
expect(this.out.getOutput()).toMatch(/Suite error: suite 1\s+Message:\s+After All Exception/);
expect(this.out.getOutput()).toMatch(/Suite error: suite 2\s+Message:\s+Some Other Exception/);
expect(this.out.getOutput()).toMatch(/Suite error: top suite\s+Message:\s+Global Exception/);
});

describe("with color", function() {
Expand Down

0 comments on commit 6b3c747

Please sign in to comment.