Improved reporting of load errors and afterAll errors

- Pass file and line number to reporters when present
- Show file and line number in the HTML reporter when present
- Visually separate adjacent errors in the HTML reporter

[#24901981]
This commit is contained in:
Steve Gravrock
2017-11-04 10:28:42 -07:00
parent ae9b95269c
commit 82eeed3c85
8 changed files with 79 additions and 25 deletions

View File

@@ -223,9 +223,21 @@ jasmineRequire.HtmlReporter = function(j$) {
}
for(i = 0; i < globalFailures.length; i++) {
var failure = globalFailures[i];
var prefix = failure.globalErrorType === 'load' ? 'Error during loading: ' : afterAllMessagePrefix;
alert.appendChild(createDom('span', {className: errorBarClassName}, prefix + failure.message));
alert.appendChild(createDom('span', {className: errorBarClassName}, globalFailureMessage(globalFailures[i])));
}
function globalFailureMessage(failure) {
if (failure.globalErrorType === 'load') {
var prefix = 'Error during loading: ' + failure.message;
if (failure.filename) {
return prefix + ' in ' + failure.filename + ' line ' + failure.lineno;
} else {
return prefix;
}
} else {
return afterAllMessagePrefix + failure.message;
}
}
var results = find('.jasmine-results');

View File

@@ -200,8 +200,9 @@ body {
display: block;
color: #eee;
&.jasmine-failed {
&.jasmine-failed, &.jasmine-errored {
background-color: $failing-color;
border-bottom: 1px solid $page-background-color;
}
&.jasmine-passed {
@@ -212,10 +213,6 @@ body {
background-color: $neutral-color;
}
&.jasmine-errored {
background-color: $failing-color;
}
&.jasmine-menu {
background-color: #fff;
color: $faint-text-color;