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:
@@ -93,12 +93,14 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
var globalErrors = new j$.GlobalErrors();
|
||||
globalErrors.install();
|
||||
globalErrors.pushListener(function(message) {
|
||||
globalErrors.pushListener(function(message, filename, lineno) {
|
||||
if (!suppressLoadErrors) {
|
||||
topSuite.result.failedExpectations.push({
|
||||
passed: false,
|
||||
globalErrorType: 'load',
|
||||
message: message
|
||||
message: message,
|
||||
filename: filename,
|
||||
lineno: lineno
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user