-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Mistakenly nested tests neither run nor result in an error #5178
Comments
Can you try this with Jest 22? We changed this to throw! Happy to reopen if it’s not fixed. |
In #4039, for reference. We should probably have a test for that behavior... |
@cpojer It works exactly as I would like under Jest 22! Excellent error messages! Thank you!
|
I came across this issue when trying to write nested data driven tests .. e.g. for each browser.. for each site .. but got error "Tests cannot be nested." |
Use describe for nesting and test.each for multiple cases |
Thanks a lot @thymikee |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Example:
https://repl.it/repls/CavernousElegantIvorybilledwoodpecker
When test cases get long, it's possible to mistakenly write a test case inside of another test case. Sometimes humans get mixed up on parentheses and braces.
When this happens, the internal test() method does not execute, and no errors are shown. Thus it's easy to add a test case that never runs.
I can't think of a reason to nest test cases, so my feeling is the expected behavior would be to raise an error in this situation.
The text was updated successfully, but these errors were encountered: