Skip to content

Commit 2a73958

Browse files
committedOct 8, 2021
Merge branch 'main' into 3.99
2 parents d506860 + 18098bf commit 2a73958

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
 

‎lib/reporters/console_reporter.js

+11
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ function ConsoleReporter() {
221221
print(failedSpecNumber + ') ');
222222
print(result.fullName);
223223
printFailedExpectations(result);
224+
225+
if (result.trace) {
226+
printNewline();
227+
print(indent('Trace:', 2));
228+
printNewline();
229+
230+
for (const entry of result.trace) {
231+
print(indent(`${entry.timestamp}ms: ${entry.message}`, 4));
232+
printNewline();
233+
}
234+
}
224235
}
225236

226237
function suiteFailureDetails(result) {

‎spec/reporters/console_reporter_spec.js

+24
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,30 @@ describe("ConsoleReporter", function() {
484484
expect(this.out.getOutput()).not.toContain("Spec has no expectations");
485485
});
486486

487+
it('reports a summary with trace info for a failed spec with trace', function() {
488+
const reporter = new ConsoleReporter();
489+
reporter.setOptions({
490+
print: this.out.print,
491+
jasmineCorePath: jasmineCorePath
492+
});
493+
494+
reporter.jasmineStarted();
495+
reporter.specDone({
496+
status: "failed",
497+
description: "with a failing spec",
498+
fullName: "A suite with a failing spec that has a trace",
499+
failedExpectations: [],
500+
passedExpectations: [],
501+
trace: [
502+
{timestamp: 1, message: 'msg 1'},
503+
{timestamp: 100, message: 'msg 2'},
504+
]
505+
});
506+
reporter.jasmineDone();
507+
508+
expect(this.out.getOutput()).toContain(' Trace:\n 1ms: msg 1\n 100ms: msg 2');
509+
});
510+
487511
it('reports a summary without a "no expectations" message for a spec having passed expectations', function () {
488512
const reporter = new ConsoleReporter();
489513
reporter.setOptions({

0 commit comments

Comments
 (0)
Please sign in to comment.