-
-
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
Async setupFiles #949
Comments
This is not possible. Can you elaborate on why you'd like to do this? |
I see, thanks. Just a an async function that preps the test environment that I can't make synchronous unfortunately. |
I don't think we'll support this as it makes everything dealing with the setup a bit more messy. The way I would suggest to work around this is something like this in your setupFile: global.it = function(description, fn) {
pit(description, () => {
// Assuming it is a promise
return loadEnvironmentAsync().then(
() => fn()
)
});
} This will make everyone of your tests async. If you are not using Let me know if this isn't a satisfying solution |
I just hit a use-case for this where I needed to do some async logic to determine which host the test suite should be running against. I will rework my solution to have the script expose data in an ENV variable for now. Would have been nice to have this though : ) |
Oh amazing #3832 (comment). Thanks @xfumihiro!! |
@jasonkuhrt happy coding! 😄 |
See also: #11038 tl;dr Using ES modules, there's early support for awaiting async effects in |
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. |
It would be useful to be able to wait for an asynchronous completion of a setupFiles module before starting tests. Is there a way to do that?
The text was updated successfully, but these errors were encountered: