Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: improve skipping #371

Open
adamcameron opened this issue Feb 23, 2021 · 2 comments
Open

Feature request: improve skipping #371

adamcameron opened this issue Feb 23, 2021 · 2 comments

Comments

@adamcameron
Copy link

I'm porting my tests from PHPUnit. Today I've been looking at dealing with incomplete (markTestIncomplete) and skipped (markTestSkipped) tests.

One can kinda mark a test incomplete at compile-time by using xdescribe and xit, but it would be good to have a runtime way of doing it as well, similar to PHPUnit. That said I think 95% of the time handling this at compile time is fine, so low impact.

I note there is a skipIf method, but was surprised to see its implementation was void function skipIf(boolean condition), where I might have expected void function skipIf(string message, callback condition) to match the implementations of it and describe, and using the same analogy. At the very least void function skipIf(boolean condition[, string message]).

I think a message is reasonably handy when skipping tests.

I checked to see if there was a precedent in other similar frameworks:

@jails
Copy link
Contributor

jails commented Feb 24, 2021

I agree markTestIncomplete can be handled with xdescribe().
In regards to Mocha & Rspec, for them skip as the same meaning as xit of xdescribe.
To actually "skip" a test you need to progamatically add a if() condition somewhere so skipIf() is just a shortcut to avoid nested if braces. But indeed void function skipIf(boolean condition[, string message]) could be a good idea, we just need to think where is the best place for displaying this message.

@adamcameron
Copy link
Author

Cheers for following this up.

I'd display it in exactly the same place / time / way as you display test failures / errors. Just in a different colour, and prefix it with SKIPPED, eg:

skipIf(true, "only test this on Tuesdays");

When reporting:

SKIPPED: only test this on Tuesdays

Maybe it's orange or light blue or something... indicates it's not completely good (green), but it's not necessarily a problem (red).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants