4

Currently, we can give reason to pending spec using pend() function this way -

xit("pending spec", function(){
    //Skipped spec
}).pend("This is a reason");

Output of the above function would be -

Sample Test: pending spec
This is a reason
Executed 1 of 1 specs (1 PENDING)

Now, how to get the same reason for the disabled suites?

xdescribe('Disabled suite' , function(){
    it('example spec', function(){
        //example
    });
}).pend("This is a reason");

Output of the above disabled suite is -

No reason given

and remains the same even if I use pend() function. Thanks!

giri-sh
  • 6,934
  • 2
  • 25
  • 50
  • 2
    The pending message on a suite is not yet supported. See by yourself: https://github.com/jasmine/jasmine/blob/master/src/core/Suite.js#L45 – Florent B. Jun 13 '16 at 17:55
  • 1
    Thanks @FlorentB. I was hoping to see some way I can make this happen. I know `pend()` doesn't work, but is there any other way that we can do it? Simply showing "No reason given" doesn't make sense without adding a customization feature to it. Thanks! – giri-sh Jun 14 '16 at 07:00

1 Answers1

2

The pending message is not implemented on a suite, but you could override the pend method to make it write the message on each spec:

jasmine.Suite.prototype.pend = function(message){
    this.markedPending = true;
    this.children.forEach(spec => spec.pend(message));
};

Usage:

xdescribe('Suite', function() {


}).pend("Feature not yet implemented");

Source code for Suite.js:

https://github.com/jasmine/jasmine/blob/master/src/core/Suite.js#L45

Florent B.
  • 41,537
  • 7
  • 86
  • 101