Suites report errors in afterAlls in the suiteDone event

- remove `afterAllEvent` from reporters
This commit is contained in:
slackersoft
2014-09-03 18:52:13 -07:00
parent 6b857d11ce
commit 9402d59859
14 changed files with 306 additions and 203 deletions

View File

@@ -55,7 +55,7 @@ getJasmineRequireObj().ConsoleReporter = function() {
yellow: '\x1B[33m',
none: '\x1B[0m'
},
exceptionList = [];
failedSuites = [];
this.jasmineStarted = function() {
specCount = 0;
@@ -87,12 +87,8 @@ getJasmineRequireObj().ConsoleReporter = function() {
print('Finished in ' + seconds + ' ' + plural('second', seconds));
printNewline();
for(i = 0; i < exceptionList.length; i++) {
printNewline();
print(colored('red', 'An error was thrown in an afterAll'));
printNewline();
print(colored('red', (exceptionList[i].message || exceptionList[i].description)));
printNewline();
for(i = 0; i < failedSuites.length; i++) {
suiteFailureDetails(failedSuites[i]);
}
onComplete(failureCount === 0);
@@ -119,8 +115,11 @@ getJasmineRequireObj().ConsoleReporter = function() {
}
};
this.afterAllError = function(error) {
exceptionList.push(error);
this.suiteDone = function(result) {
if (result.failedExpectations && result.failedExpectations.length > 0) {
failureCount++;
failedSuites.push(result);
}
};
return this;
@@ -166,6 +165,17 @@ getJasmineRequireObj().ConsoleReporter = function() {
printNewline();
}
function suiteFailureDetails(result) {
for (var i = 0; i < result.failedExpectations.length; i++) {
printNewline();
print(colored('red', 'An error was thrown in an afterAll'));
printNewline();
print(colored('red', 'AfterAll ' + result.failedExpectations[i].message));
}
printNewline();
}
}
return ConsoleReporter;