HtmlReporter shows error alerts for afterAllExceptions

-Add list of exceptions in HtmlReporter to push to on error
-Create alerts for each exception in the list (with stack trace)

[#67055688]
This commit is contained in:
Christopher Amavisca and Greg Cobb
2014-03-06 15:39:04 -08:00
parent 6caf4c5de2
commit bed1c15ea4
5 changed files with 43 additions and 15 deletions

View File

@@ -17,7 +17,8 @@ jasmineRequire.HtmlReporter = function(j$) {
failureCount = 0,
pendingSpecCount = 0,
htmlReporterMain,
symbols;
symbols,
exceptionsList = [];
this.initialize = function() {
htmlReporterMain = createDom('div', {className: 'html-reporter'},
@@ -65,7 +66,7 @@ jasmineRequire.HtmlReporter = function(j$) {
};
this.afterAllException = function(error) {
console.error(error);
exceptionsList.push(error);
};
var failures = [];
@@ -140,6 +141,12 @@ jasmineRequire.HtmlReporter = function(j$) {
var statusBarClassName = 'bar ' + ((failureCount > 0) ? 'failed' : 'passed');
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
exceptionsList.forEach(function(error) {
var errorBarMessage = 'An error was thrown in an afterAll: ' + error.stack;
var errorBarClassName = 'bar errored';
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
});
var results = find('.results');
results.appendChild(summary);