Remove 'empty' as an option as a spec result
- Having the 'empty' state for a spec result can be considered a breaking change to the reporter interface - Instead, we determine if a spec has no expectations using the added key of 'passedExpectations' in combination of the 'failedExpectations' to determine that there a spec is 'empty' [fixes #73741032]
This commit is contained in:
@@ -13,7 +13,6 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
this.expectationResultFactory = attrs.expectationResultFactory || function() { };
|
||||
this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
|
||||
this.catchingExceptions = attrs.catchingExceptions || function() { return true; };
|
||||
this.expectCalled = false;
|
||||
|
||||
if (!this.fn) {
|
||||
this.pend();
|
||||
@@ -29,7 +28,6 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
}
|
||||
|
||||
Spec.prototype.addExpectationResult = function(passed, data) {
|
||||
this.expectCalled = true;
|
||||
var expectationResult = this.expectationResultFactory(data);
|
||||
if (passed) {
|
||||
this.result.passedExpectations.push(expectationResult);
|
||||
@@ -103,10 +101,6 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
return 'pending';
|
||||
}
|
||||
|
||||
if(!this.expectCalled) {
|
||||
return 'empty';
|
||||
}
|
||||
|
||||
if (this.result.failedExpectations.length > 0) {
|
||||
return 'failed';
|
||||
} else {
|
||||
|
||||
@@ -67,7 +67,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
|
||||
var failures = [];
|
||||
this.specDone = function(result) {
|
||||
if(result.status == 'empty' && console && console.error) {
|
||||
if(noExpectations(result) && console && console.error) {
|
||||
console.error('Spec \'' + result.fullName + '\' has no expectations.');
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
|
||||
symbols.appendChild(createDom('li', {
|
||||
className: result.status,
|
||||
className: noExpectations(result) ? 'empty' : result.status,
|
||||
id: 'spec_' + result.id,
|
||||
title: result.fullName
|
||||
}
|
||||
@@ -174,7 +174,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
domParent.appendChild(specListNode);
|
||||
}
|
||||
var specDescription = resultNode.result.description;
|
||||
if(resultNode.result.status == 'empty') {
|
||||
if(noExpectations(resultNode.result)) {
|
||||
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
||||
}
|
||||
specListNode.appendChild(
|
||||
@@ -269,6 +269,11 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
function setMenuModeTo(mode) {
|
||||
htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode);
|
||||
}
|
||||
|
||||
function noExpectations(result) {
|
||||
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
||||
result.status === 'passed';
|
||||
}
|
||||
}
|
||||
|
||||
return HtmlReporter;
|
||||
|
||||
Reference in New Issue
Block a user