javascripttestingjasmineprotractorjasmine-reporters

Is it possible to send a reason for Jasmine 2 specs skipped with xit or pending()?


When we find a bug with one of our Protractor Jasmine2 specs, we usually want to skip the test until the bug has been resolved.

I know how to do this with xit or pending(), and JasmineReporters TerminalReporter is doing a nice job of color highlighting and listing pending specs.

However, the pending tests always report No reason given, which implies it is possible to give a reason for the skipped test.

I currently comment the spec with an issue number, but it would be really nice to report the reason the test was disabled and the issue number.

UPDATE

As requested, adding example terminal output ( fdescribe on an example, so reporting most of the suite disabled ):

Versions: Protractor 2.1.0 and Jasmine 2.3.1

Using xit

 Skipped
*      will display the platform if available ...
...
SUCCESS: 85 specs, 0 failures, 1 skipped, 72 disabled in 34.734s.
Pending:

1) will display the platform if available
No reason given

Using pending()

This appears to have started marking it failed, probably related to https://github.com/angular/protractor/issues/1852

Failures:
1) will display the platform if available
Message:
Failed: => marked Pending
Stack:
Error: Failed: => marked Pending

UPDATED: Related feature requests and issues for this functionality

There is currently a feature request to support pending(message) outstanding for Protractor/jasminewd if you want to follow progress :

https://github.com/angular/jasminewd/issues/32 https://github.com/angular/protractor/issues/2454


Solution

  • Another way would be to call the pend method on the test itself:

    xit('Pending test description', function() {
        // test body
    }).pend('Reason for being disabled');