-
-
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
skip doesn't work for nested describes #2683
Comments
I think it would make more sense for you to pull your condition out of the mocha internals altogether: if(process.env.NODE_ENV !== 'staging') {
describe('...', function () {
describe('...', function () {
});
});
} Does that solve your problem? |
Thanks for the answer. I actually do it like you propose, but technically its a hack. I want to have the output: |
If I wanted to display pending tests I would probably do something like var envDescribe = process.NODE_ENV === 'staging' ? describe.skip : describe;
envDescribe('...', function () {
envDescribe('...', function () {
});
}); |
it solves the issue, thx. If you want a few points on SO, feel free to copypaste you answer and I'll receive |
I'm fine without the points. Happy testing :) |
@Munter I found a problem with your solution. If somebody write something like envDescribe.skip, we will have a problem and it will appear only under some circumstances which makes it's really flaky |
When that does appear, though, it should throw a hard error and block the test suite from even running (thus making the problem impossible to overlook), if I'm not mistaken? A possible alternative may be to |
This definitely is surprising behaviour, given that most other behaviour is nested by context (e.g |
Definitely worth re-opening as I'm trying to skip in an async function (and I don't think that wrapping everything in the callback is nice TBH). |
for me worked setting pending prop to true
-- skips current and all nested describes |
copied from my question on SO
I have some code below:
When I run
NODE_ENV='staging' npm test
:But I expect that all the tests are skipped. So, the question:
The text was updated successfully, but these errors were encountered: