Calling `pending` in a spec marks the spec as failed.
See the attached testcase
https://gist.github.com/sveneh/9c589d321e6fc31f7460
When I run this in [email protected] using [email protected] I get this:
>protractor pending.conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.88.100:60036/wd/hub
Started
F*
Failures:
1) a spec with pending should be pending
Message:
Failed: => marked PendingThis is pending.
Stack:
Error: Failed: => marked PendingThis is pending.
Pending:
1) a spec with pending should be also pending
No reason given
2 specs, 1 failure, 1 pending spec
Finished in 0.006 seconds
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
running the same spec in pure [email protected]:
>jasmine
Started
**
Pending:
1) a spec with pending should be pending
This is pending.
2) a spec with pending should be also pending
No reason given
2 specs, 0 failures, 2 pending specs
Finished in 0.002 seconds
Protractor should not fail specs that are marked as pending.
I'm experiencing this too. It would be good to get resolved so I can have accurate reports to delineate tests actually failing and tests being skipped.
Someone please fix this!! In the meantime, to mark as pending without using pending("reason") use xit('some spec description', function (){
+1 That's a pretty cool jasmine2 feature and it's a pity that we cannot use it with protractor. Is anyone taking care of this?
+1
See https://github.com/angular/jasminewd/issues/27#issuecomment-144882283
+1 this is really anoying! I want to be able to put tests to pending with correct messages in log.
As a workaround I introduced an own pending to use in my protractor tests (overwriting the jasmine pending), maybe that is helpful for somebody else as a workaround:
// in my protractor onPrepare code:
var _pending = pending;
pending = function(pendingMessage) {
return {
it: function(description, itFunction) {
var consoleColorYellowStart = '\u001B[33m';
var consoleColorYellowEnd = '\u001B[0m';
return xit(description + '\n ' + consoleColorYellowStart + 'Marked as Pending: ' + pendingMessage + consoleColorYellowEnd, itFunction);
},
describe: function(description, describeFunction) {
return describe(description, function() {
_pending(pendingMessage);
return describeFunction();
});
},
here: function() {
return _pending(pendingMessage);
}
};
};
Usage:
pending('my pending comment').describe('my describe block', function() { ... });
or
pending('my pending comment').it('my it block', function() { ... });
or (just in case you still need the old pure jasmine pending implementation somewhere else, with all advantages and disadvantages)
pending('my pending comment').here();
+1
Still experiencing this, meanwhile the workaround works like a charm @bruderol thanks!
Also feeling some burn here +1
+1 also happening here. :(
+1
+1
In the meantime I found out that there is a possibility to set comments on tests ignored with xit and therefore even improved my workaround a little bit:
// in my protractor onPrepare code:
var _pending = pending;
pending = function(pendingMessage) {
return {
it: function(description, itFunction) {
var spec = xit(desription, itFunction);
spec.pend(pendingMessage);
return spec;
},
describe: function(description, describeFunction) {
return describe(description, function() {
_pending(pendingMessage);
return describeFunction();
});
},
here: function() {
return _pending(pendingMessage);
}
};
};
Usage:
pending('my pending comment').describe('my describe block', function() { ... });
or
pending('my pending comment').it('my it block', function() { ... });
or (just in case you still need the old pure jasmine pending implementation somewhere else, with all advantages and disadvantages)
pending('my pending comment').here();
also experiencing this, is this issue currently being worked on?
+1. Also faced with this issue
+1 Should be priorize, this is a very usefull feature.
Closing in favor of https://github.com/angular/jasminewd/issues/32
Note that this is pending a change to Jasmine.
I extended the jasmine-spec-reporter (https://www.npmjs.com/package/jasmine-spec-reporter)
var SpecReporter = require('jasmine-spec-reporter');
var PendingSpecReporter = SpecReporter;
PendingSpecReporter.prototype.specDone = function (spec) {
this.metrics.stopSpec(spec);
var pending = false;
for(var i = 0; i < spec.failedExpectations.length; i++) {
if ( spec.failedExpectations[i].message.toLowerCase().indexOf('pending') >= 0) pending = true;
}
if (spec.status === 'pending' || pending) {
this.metrics.pendingSpecs++;
this.display.pending(spec);
} else if (spec.status === 'passed') {
this.metrics.successfulSpecs++;
this.display.successful(spec);
} else if (spec.status === 'failed') {
this.metrics.failedSpecs++;
this.display.failed(spec);
}
};
module.exports = PendingSpecReporter;
Specs marked as pending are displayed as pending in the report.
This hack works for me while we don't have https://github.com/angular/jasminewd/issues/32
// In protractor `onPrepare`
jasmine.Suite.prototype.pend = function (message) {
this.markedPending = true;
this.children.forEach(spec => spec.pend(message));
};
xdescribe('Foo', function(){
// bar
}).pend('reason');