-
-
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
Delay root suite execution on a file by file basis #4021
Comments
I haven't studied your example in detail, but why don't you put this |
@juergba thanks for the response. I’m not sure if I know what you mean by a separate before hook. Do you mean to use nested describes, each with this before hook would be in the outer one? Thanks! |
With |
closed by #4617. |
Description
As we are developing our suite of tests, we are running into the limitation/added complexity of needing to delay all test execution, via the
--delay
flag. In our case, we don't need to delay all tests, and in fact, only some need to delay the root suite execution to seed data via an asynchronous operations. I believe this feature request supports #3781.Desired solution
It would be awesome if Mocha had an optional async hook that fired before the rest of the test, allowing for asynchronous operations before that test is run. For example, if this hook was named
preflight
, it could look something like:Alternatives considered
I have documented more of this in more detail at https://stackoverflow.com/questions/57929444/delay-mocha-test-programmatically, but in short, if not using the
--delay
flag, I can leverage asynchronous hooks to achieve a similar result as the one desired. But, the issue I am running in is that I cannot combine asynchronous hooks and dynamically generate tests. That is, instead of generating one test for each node of asynchronous data, those nodes are looped through within the single test.The text was updated successfully, but these errors were encountered: