-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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: Allow adding a description with the reason why a test is pending #2026
Comments
As a lightweight workaround, I would think of tweaking the test description to include the reason why it’s pending. 😊 xit('works as expected; PENDING: waiting for a dependency to be implemented', function() {
}); I’m guessing this would work, but I curious to know how would such a feature be useful? 👷 |
This feature is pretty useful, is is not a good idea to mix test description and reason why test is pending. pend() method allows to distinguish pend reason from description. And instead of meaningless reason "No reason given" in jasmine you can add more info, issue number, etc. |
What would the syntax be for this feature? I would expect something like: // describe.skip = xdescribe
describe.skip('Foo', function () {
...
}, 'Reason Foo was skipped');
describe('Bar', function () {
// it.skip = xit
it.skip('#baz', function () {
...
}, 'Reason #baz was skipped');
}); Or would a chained function be more readable? describe.skip('Foo', function () {
...
})
.because('Reason Foo was skipped');
describe('Bar', function () {
it.skip('#baz', function () {
...
})
.because('Reason #baz was skipped');
}); |
* Added reason to skip() * Added skip() tests for tdd, bdd, and qunit
* Added reason to spec reporter * Added reason tests for spec reporter
* Added reason to spec reporter * Added reason tests for spec reporter
I like the chain version since that seems to be the best inline with how the rest of mocha operates |
Added an optional reason for pending tests.
Added reason to reporters. * spec * xunit * json
Revert "Added skip reason for issue mochajs#2026" This reverts commit bd784b3.
skip and pending isn't the same though. In mocha, when your it block only has a description, it is pending. So I believe that it would be better to add the reason as the second argument then. So then mocha just has to look at the second argument to see if it is undefined (which it already does) or if it's a string, and then the test is pending, using the string value as the reason. Of course, if we want the same thing for skipped tests, which you would do because you can't fix the test code for the moment for example, then you still want a way to add a reason. If using the before mentioned way, you can add a reason as third argument. But using chaining like @rdennis comment, could also be fine. I just wanted to point out that pending isn't the same as skip, and as the topic starter asked about pending reasons.... |
Using xit.() makes tests pending - which confused me as a new user because pending means "awaiting decision or settlement." - i assumed it was some async that hadn't completed. seems skipped would be a better description for xit.
|
Triaging with @voxpelli: amusingly, this first + simplest approach seems the most reasonable to us. We can see why an explicit indicator would be useful - but it's not a particularly common need, and adding a description to the test description is a pretty good workaround for most. Closing as wontfix, as #928 (test metadata) would be a better holistic solution. Thanks all! 🤎 |
I can add pending reason in Jasmine tests with
.pend()
method and replacingit()
withxit()
like this:Can I somehow add a pending reason message for Mocha tests?
The text was updated successfully, but these errors were encountered: