Display deprecation warnings in HTML reporter

- Also no longer check for stack since IE doesn't do that

[#154746527]
This commit is contained in:
Gregg Van Hove
2018-02-05 12:11:36 -08:00
parent 5afe1222f4
commit 24bf3489dc
6 changed files with 87 additions and 14 deletions

View File

@@ -59,7 +59,8 @@ jasmineRequire.HtmlReporter = function(j$) {
results = [],
htmlReporterMain,
symbols,
failedSuites = [];
failedSuites = [],
deprecationWarnings = [];
this.initialize = function() {
clearPrior();
@@ -97,6 +98,7 @@ jasmineRequire.HtmlReporter = function(j$) {
}
stateBuilder.suiteDone(result);
addDeprecationWarnings(result);
};
this.specStarted = function(result) {
@@ -140,6 +142,8 @@ jasmineRequire.HtmlReporter = function(j$) {
failures.push(failure);
}
addDeprecationWarnings(result);
};
this.jasmineDone = function(doneResult) {
@@ -249,6 +253,14 @@ jasmineRequire.HtmlReporter = function(j$) {
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessagePrefix + failure.message));
}
addDeprecationWarnings(doneResult);
var warningBarClassName = 'jasmine-bar jasmine-warning';
for(i = 0; i < deprecationWarnings.length; i++) {
var warning = deprecationWarnings[i];
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning.message));
}
var results = find('.jasmine-results');
results.appendChild(summary);
@@ -323,6 +335,12 @@ jasmineRequire.HtmlReporter = function(j$) {
return this;
function addDeprecationWarnings(result) {
if (result && result.deprecationWarnings && result.deprecationWarnings.length > 0) {
deprecationWarnings = deprecationWarnings.concat(result.deprecationWarnings);
}
}
function find(selector) {
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
}

View File

@@ -216,6 +216,10 @@ body {
background-color: $failing-color;
}
&.jasmine-warning {
background-color: $pending-color;
}
&.jasmine-menu {
background-color: #fff;
color: $faint-text-color;