-
Notifications
You must be signed in to change notification settings - Fork 113
Fix updateProps Function #170
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #170 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 90 88 -2
Branches 28 28
=========================================
- Hits 90 88 -2
Continue to review full report at Codecov.
|
bc7c1c9 to
ddd4cc8
Compare
|
Hi! Thank you very much for this 🙌 It would be great if you could add a test that would fail with the previous implementation and that passes with the proposed one, so that we could easily see the issue and how it is prevented :) |
|
I know the code change, but I don't seem to be able to run a check locally. After running an |
* Changed updateProps to return the Promise created from wrapper.setProps. * Updated the `updateProps` test to make sure the function can be called multiple times without producing errors.
ddd4cc8 to
8d8aee2
Compare
|
@afontcu Done. Regarding my previous comment, it seems that
Will cause problems to happen -- at least on certain machines. And the problem is that future installs on the I'm running Ubuntu 18.04. After installing on |
|
Hi!
This is intentional, see https://github.com/testing-library/vue-testing-library/blob/master/.npmrc |
|
🎉 This PR is included in version 5.3.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
That makes sense. Thanks! |
|
Thank you! 🤗 |
|
🎉 This PR is included in version 6.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The Problem
I just discovered a bug in one of my projects with the
updatePropsfunction returned fromrender. WheneverupdatePropsis called multiple times, several errors are logged in the console and Jest is prevented from finishing its test run. This is a huge bug for obvious reasons. Anyone can reproduce this error by grabbing the (currently) latest version of VTL and making multipleawaited calls toupdatePropsin a test for a Vue component.The logged errors seem to be related to asynchronicity. I think that since the
Promisereturned fromupdatePropsis different from the one returned fromwaitFor, everything gets thrown out of balance when the developer tries to run tests with multipleupdatePropscalls.The fix I'm proposing simply returns the
Promiseobtained fromwrapper.setPropsdirectly. I applied this fix to mynode_modules, and my tests behaved properly afterwards.Changes