Skip to content

Commit 6b3c747

Browse files
committed
Report top suite name as "top suite", not "undefined"
1 parent 18098bf commit 6b3c747

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

lib/reporters/console_reporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function ConsoleReporter() {
9393
}
9494

9595
if (result && result.failedExpectations && result.failedExpectations.length > 0) {
96-
suiteFailureDetails(result);
96+
suiteFailureDetails({ fullName: 'top suite', ...result });
9797
}
9898

9999
if (pendingSpecs.length > 0) {

spec/reporters/console_reporter_spec.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,16 +551,22 @@ describe("ConsoleReporter", function() {
551551
const reporter = new ConsoleReporter();
552552
reporter.setOptions({
553553
print: this.out.print,
554-
showColors: true
554+
showColors: false
555555
});
556556

557-
reporter.suiteDone({ failedExpectations: [{ message: 'After All Exception' }] });
558-
reporter.suiteDone({ failedExpectations: [{ message: 'Some Other Exception' }] });
557+
reporter.suiteDone({
558+
fullName: 'suite 1',
559+
failedExpectations: [{ message: 'After All Exception' }]
560+
});
561+
reporter.suiteDone({
562+
fullName: 'suite 2',
563+
failedExpectations: [{ message: 'Some Other Exception' }]
564+
});
559565
reporter.jasmineDone({ failedExpectations: [{ message: 'Global Exception' }] });
560566

561-
expect(this.out.getOutput()).toMatch(/After All Exception/);
562-
expect(this.out.getOutput()).toMatch(/Some Other Exception/);
563-
expect(this.out.getOutput()).toMatch(/Global Exception/);
567+
expect(this.out.getOutput()).toMatch(/Suite error: suite 1\s+Message:\s+After All Exception/);
568+
expect(this.out.getOutput()).toMatch(/Suite error: suite 2\s+Message:\s+Some Other Exception/);
569+
expect(this.out.getOutput()).toMatch(/Suite error: top suite\s+Message:\s+Global Exception/);
564570
});
565571

566572
describe("with color", function() {

0 commit comments

Comments
 (0)