Description
openedon Sep 9, 2022
Is your feature request related to a problem or a nice-to-have?? Please describe.
I'm one of the maintainers of a popular tool that uses Mocha to run our users' tests. We get periodic reports about our tool not running any test (example), and in many cases, this is because the user is passing async functions to describe
.
Describe the solution you'd like
I think throwing an error if executing the callback received by describe
/context
(I may be missing others) returns a Promise
, explaining that the callback should be synchronous would be beneficial to Mocha's users.
Describe alternatives you've considered
For typescript users, we could partially achieve this by modifying @types/mocha
so that the functions I mention stop accepting async functions, but that would be a partial solution, as not everyone uses typescript.
Additional context
This is a screenshot of a modified version of Mocha that behaves as proposed.
I can send a PR if there's interest in this feature.