-
-
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
feat(jest-runner): allow setupFiles
module to export an async function
#12042
Conversation
Codecov Report
@@ Coverage Diff @@
## main #12042 +/- ##
==========================================
- Coverage 68.77% 68.72% -0.05%
==========================================
Files 324 324
Lines 16670 16682 +12
Branches 4814 4818 +4
==========================================
Hits 11465 11465
- Misses 5172 5184 +12
Partials 33 33
Continue to review full report at Codecov.
|
Completely lost track of this. Could you rebase @mrazauskas? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Closes #11038
Summary
As it is described in the issue, async function in
setupFiles
modules might be useful to fetch data asynchronously.I do not think it is the best place to set up a database, because there is no way to tear it down later without some additional script. But fetching some fixture data and temporary storing it in an object would work.
The implementation is only targeting CJS modules, because (as it was pointed out in the issue) ESM modules allow top-level await. In way this PR simply enables CJS users to have similar functionality as ESM user have.Test plan
Integration test is added.