Skip to content
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

Allow returning non-serializable values from waitFor #732

Merged
merged 3 commits into from
Aug 24, 2023
Merged

Conversation

calebeby
Copy link
Member

@calebeby calebeby commented Aug 23, 2023

Closes #633.

Previously, using waitFor only would return values if they were serializable. (The new test would fail, waitFor would return undefined). This is because our implementation of waitFor defers to Testing Library's in-browser implementation (uses MutationObserver + timers to watch for changes). Previously the return value got passed to the browser and back.

In this PR, I changed the return value from the callback to never go to the browser and back, it just stays in node, so we don't have to worry about serialization or deserialization.

@calebeby calebeby marked this pull request as ready for review August 23, 2023 22:47
Copy link
Member

@Paul-Hebert Paul-Hebert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have enough context to 100% understand these changes but I don't see any obvious issues and they seem reasonable to me.

^"
^
-------------------------------------------------------
dist/cjs/index.cjs"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking that it was expected for this test's output to change as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure why this changed (not sure why it was how it was before this PR) but yes this is the expected output

@calebeby calebeby merged commit 29b8671 into main Aug 24, 2023
5 checks passed
@calebeby calebeby deleted the waitfor-return branch August 24, 2023 16:29
@github-actions github-actions bot mentioned this pull request Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should waitFor return a JSHandle?
2 participants