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

@@ -46,7 +46,8 @@ jasmineRequire.HtmlReporter = function(j$) {
failureCount = 0,
pendingSpecCount = 0,
htmlReporterMain,
symbols;
symbols,
exceptionsList = [];
this.initialize = function() {
htmlReporterMain = createDom('div', {className: 'html-reporter'},
@@ -94,7 +95,7 @@ jasmineRequire.HtmlReporter = function(j$) {
};
this.afterAllException = function(error) {
console.error(error);
exceptionsList.push(error);
};
var failures = [];
@@ -169,6 +170,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);

View File

@@ -25,6 +25,7 @@ body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
.html-reporter .bar.failed { background-color: #ca3a11; }
.html-reporter .bar.passed { background-color: #007069; }
.html-reporter .bar.skipped { background-color: #bababa; }
.html-reporter .bar.errored { background-color: #ca3a11; }
.html-reporter .bar.menu { background-color: #fff; color: #aaaaaa; }
.html-reporter .bar.menu a { color: #333333; }
.html-reporter .bar a { color: white; }