Is it possible to set a message (mentioning reason) why a particular test is skipped, so that it could be used in reporters.
describe('xxx', function() {
checkToSkip(1)("test1", function() {\*test goes here*\});
checkToSkip(4)("test2", function() {\*test goes here*\});
});
function checkToSkip(now) {
return now > 3 ? it : xit;
//return now > 3 ? it : it.skip;
}
Here 'test1' will be skipped as 'checkToSkip' returns 'xit' (or it.skip). Is it possible to pass a message to reporter mentioning the reason for the test skip? something like below (or any other possible way).
checkToSkip(4)("test2", function() { \\ test goes here}, "My Skip message!!!!" );
or
checkToSkip(4)("test2", function() { \\ test goes here}).pending("My Skip message!!!!");
Note: Im using mocha in webdriverIO.
Thanks.
This thread explains the solution for same problem using Jasmine. Im looking for something similar in Mocha.
I too would love to have something like that.
I could not find any inputs about how to enter reason for skipping in documentation here
May be a candidate for a feature request? It could just be a case that the documentation is missing while feature is there.
fyi: a workaround to achieve this is available in above thread.
this would be a good usability improvement, but see @ponmudivn's workaround
One approach that could cover all use cases and would only be a small api change would be to allow an optional reason parameter to this.skip(). The it.skip(...) case could be satisfied by just calling this.skip("reason") in the first line of the test.
Agreed with @jeffvandyke I would love to have this feature
How about doing:
it.skip("A test").reason("Code has changed");
But that doesn't allow for using the this.skip api, so maybe it can also accept a second or third string parameter as the reason as well. But that just seems weird in my opinion.
duplicate of #2026
Most helpful comment
One approach that could cover all use cases and would only be a small api change would be to allow an optional
reasonparameter tothis.skip(). Theit.skip(...)case could be satisfied by just callingthis.skip("reason")in the first line of the test.