ConsoleReporter exits 1 when afterAll events occur

[Finishes #67068790]
This commit is contained in:
Greg Cobb and Tim Jarratt
2014-08-27 14:45:59 -07:00
parent 5b6edff3fd
commit cd4d5c2445
2 changed files with 25 additions and 5 deletions
+24 -5
View File
@@ -159,21 +159,40 @@ describe("ConsoleReporter", function() {
out.clear(); out.clear();
reporter.jasmineDone({}); reporter.jasmineDone();
expect(out.getOutput()).toMatch(/foo bar baz/); expect(out.getOutput()).toMatch(/foo bar baz/);
}); });
it("calls the onComplete callback when the suite is done", function() { describe('onComplete callback', function(){
var onComplete = jasmine.createSpy('onComplete'), var onComplete, reporter;
beforeEach(function() {
onComplete = jasmine.createSpy('onComplete');
reporter = new j$.ConsoleReporter({ reporter = new j$.ConsoleReporter({
print: out.print, print: out.print,
onComplete: onComplete onComplete: onComplete
}); });
reporter.jasmineStarted();
});
reporter.jasmineDone({}); it("is called when the suite is done", function() {
reporter.jasmineDone();
expect(onComplete).toHaveBeenCalledWith(true);
});
expect(onComplete).toHaveBeenCalled(); it('calls it with false if there are spec failures', function() {
reporter.specDone({status: "failed", failedExpectations: []});
reporter.jasmineDone();
expect(onComplete).toHaveBeenCalledWith(false);
});
it('calls it with false if there are afterAll events', function() {
reporter.afterAllEvent("bananas");
reporter.specDone({status: "passed"});
reporter.jasmineDone();
expect(onComplete).toHaveBeenCalledWith(false);
});
}); });
describe("with color", function() { describe("with color", function() {
+1
View File
@@ -83,6 +83,7 @@ getJasmineRequireObj().ConsoleReporter = function() {
}; };
this.afterAllEvent = function(error) { this.afterAllEvent = function(error) {
failureCount++;
exceptionList.push(error); exceptionList.push(error);
}; };