Specs without expectations should be alerted to the user
- Add console.error to the HtmlReporter when there is a spec without any expectation - Change the spec's link text and color to include a warning - Create a status for specs to label them as "empty" - console is not accessible to IE unless you have developer tools open, so protect against that by mocking console. [#59424794]
This commit is contained in:
parent
71dbffeaef
commit
1922514f2d
@@ -66,6 +66,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
|
||||
var failures = [];
|
||||
this.specDone = function(result) {
|
||||
if(result.status == 'empty' && console && console.error) {
|
||||
console.error('Spec \'' + result.fullName + '\' has no expectations.');
|
||||
}
|
||||
|
||||
if (result.status != 'disabled') {
|
||||
specsExecuted++;
|
||||
}
|
||||
@@ -160,12 +164,16 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
specListNode = createDom('ul', {className: 'specs'});
|
||||
domParent.appendChild(specListNode);
|
||||
}
|
||||
var specDescription = resultNode.result.description;
|
||||
if(resultNode.result.status == 'empty') {
|
||||
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
||||
}
|
||||
specListNode.appendChild(
|
||||
createDom('li', {
|
||||
className: resultNode.result.status,
|
||||
id: 'spec-' + resultNode.result.id
|
||||
},
|
||||
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
||||
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user