-
-
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
Test environment async setup with transformations #5386
Comments
It looks like the only workaround is to mock/refactor my init function to be synchronous :( |
Hm, looks similar to #5164 |
Yup, looks like a dupe of #5164. Wanna send a PR with a fix? :) |
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. |
Do you want to request a feature or report a bug?
A feature: asynchronous test setup should apply transformations.
What is the current behavior?
Currently there are the following options to introduce setup code:
Two of those (globalSetup and setupTestFrameworkScriptFile) enable asynchronous setup:
Unfortunately, neither of these methods satisfy requirements.
The first method doesn't allow babel transformations. It looks like async code executed in the context of main process, not in the context of worker process.
In the second method it is executed in the context of process, but it's already too late as beforeAll is executed after the test is imported.
What is the expected behavior?
I need a way to execute async setup code before the test module is imported, so that the code in test module is run after my app is initialized. Current
globalSetup
option doesn't apply transformations.Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
Jest 22
Node 8
Yarn 1
The text was updated successfully, but these errors were encountered: