-
Notifications
You must be signed in to change notification settings - Fork 252
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!: async APIs #790
feat!: async APIs #790
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d24ffee:
|
Codecov Report
@@ Coverage Diff @@
## alpha #790 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 71 76 +5
Lines 1603 1542 -61
Branches 602 575 -27
=========================================
- Hits 1603 1542 -61
Continue to review full report at Codecov.
|
🎉 This PR is included in version 14.0.0-alpha.15 🎉 The release is available on: Your semantic-release bot 📦🚀 |
BREAKING CHANGE: APIs always return a Promise.
What:
Make all APIs asynchronous.
Restructure how we expose the APIs.
Why:
Closes #504
How:
userEvent.anyApi()
set up the effective APIs internally with the given options and then call it.This direct setup does not replace
window.navigator.clipboard
.userEvent.setup
sets up the effective APIs with the given options.This setup does replace
window.navigator.clipboard
. (We can make this optional).setup
from the APIs.asyncWrapper
Checklist:
Next steps?
Callable default export
As we already move around a lot here:Should we make the default export callable instead of adding
setup
to separate the specialsetup
API from our functional APIs ?Making the default export callable does not result in a good developer experience as TS does not allow to remove the Function prototype methods/properties from the callable without reporting it as not-callable. So it's either a TS error or a polluted auto-complete.
Refactor tests
The tests have been roughly kept in place to make it easier to spot changes.
Files have been moved, modules have been rewritten and responsibilities have been shifted between parts of the codebase. Therefore a lot of tests are redundant. And some edge cases are covered by also testing for implementation details and noise. We have way to many snapshots and sometimes lack explicit assertions of the tested aspects.