Closed KevinBon closed 10 months ago
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 10a1ac7c52e8c027959bf7ff1c7368b77bd56168:
Sandbox | Source |
---|---|
react-testing-library-examples | Configuration |
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
a7b7252
) 100.00% compared to head (10a1ac7
) 100.00%. Report is 4 commits behind head on alpha.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@eps1lon I changed the solution implementation.
You can find a reproduction example on this repository.
Output example:
It's been a while since I have used jest
, so I'm not sure how to test "this behavior" on jest to satisfy the test code coverage
Don't hesitate if you have any other questions 🙇
Uh oh! @KevinBon, the image you shared is missing helpful alt text. Check https://github.com/testing-library/dom-testing-library/pull/1271#issuecomment-1745413251.
Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.
Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
I created a branch to show-case that applying this patch will fix this behavior: https://github.com/KevinBon/jasmine-tl-waitfor-leak/pull/1
@eps1lon I added a reproducible test for jest
through https://github.com/testing-library/dom-testing-library/pull/1271/commits/ce11c0f9f51f51f1e84cb790016d83f44502ec87
@eps1lon let me know if you need additional information or are unhappy with my changes 🙇
@eps1lon bumping, let me know if you need anything from me. Thank you!
Thanks for the patience. Checking this out now so that we can land it ASAP.
@all-contributors add @KevinBon for code, bugs
@eps1lon
I've put up a pull request to add @KevinBon! :tada:
What:
Prevent
waitFor
callback from being invoked even after it resolved, onwaitFor
timeout.Why:
More context can be found in this issue, but with that context in mind, it's preventing test side-effects:
afterEach
should be enough to "clean" the previous test from any side-effect. However, because of the callback leak issue,window.variable
will remain to be123
even after being set back to1
for a short period of time.How:
When the clock is mocked, only call
checkCallback
whenfinished
isfalse
Checklist:
resolves https://github.com/testing-library/dom-testing-library/issues/1270