Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #83 - default console reporter hangs sometimes #84

Merged
merged 2 commits into from
Sep 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/reporters/console_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ function ConsoleReporter(options) {
}

function defaultStackFilter(stack) {
if (!stack) {
return '';
}

var filteredStack = stack.split('\n').filter(function(stackLine) {
return stackLine.indexOf(jasmineCorePath) === -1;
}).join('\n');
Expand Down
30 changes: 30 additions & 0 deletions spec/reporters/console_reporter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,36 @@ describe("ConsoleReporter", function() {
expect(this.out.getOutput()).not.toMatch(jasmineCorePath);
});

it("reports a summary when done in case that stack is somehow undefined", function() {
var reporter = new ConsoleReporter({
print: this.out.print,
jasmineCorePath: jasmineCorePath
});

reporter.jasmineStarted();
reporter.specDone({status: "passed"});
reporter.specDone({
status: "failed",
description: "with a failing spec",
fullName: "A suite with a failing spec",
failedExpectations: [
{
passed: false,
message: "Expected true to be false.",
expected: false,
actual: true,
stack: undefined
}
]
});

this.out.clear();

reporter.jasmineDone();

expect(this.out.getOutput()).toMatch(/true to be false/);
});

it("reports a summary when done that includes custom filtered stack traces for a failing suite", function() {
var stackLine = 'custom line of stack';
var customStackFilter = function(stack) {
Expand Down