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:
@@ -252,9 +252,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');
|
||||
|
||||
@@ -29,10 +29,9 @@ body { overflow-y: scroll; }
|
||||
.jasmine_html-reporter .jasmine-run-options .jasmine-payload { position: absolute; display: none; right: -1px; border: 1px solid #8a4182; background-color: #eee; white-space: nowrap; padding: 4px 8px; }
|
||||
.jasmine_html-reporter .jasmine-run-options .jasmine-payload.jasmine-open { display: block; }
|
||||
.jasmine_html-reporter .jasmine-bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-failed { background-color: #ca3a11; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-failed, .jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; border-bottom: 1px solid #eee; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-passed { background-color: #007069; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-skipped { background-color: #bababa; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-menu { background-color: #fff; color: #aaa; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-menu a { color: #333; }
|
||||
.jasmine_html-reporter .jasmine-bar a { color: white; }
|
||||
|
||||
@@ -774,12 +774,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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user