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

Workaround for snapshots for async rsc #12

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

abel-castro
Copy link

@abel-castro abel-castro commented Aug 12, 2024

I discovered what I believe is an issue when using snapshots with Vitest and async react server components.
The snapshots were being generated as an empty <div /> tag. My workaround was to first perform some screen assertions (as shown in the test cases).
After doing this, the snapshots are generated correctly when using toMatchSnapshot.

As part of this PR, I also updated Vitest to a newer version (2.0.5), as I don't see any reason to stay in version 0.3.4.

I discovered what I believe is an issue when using snapshots with Vitest and React server components.
The snapshots were being generated as an empty `<div />` tag.
My workaround was to first perform some `screen` assertions (as shown in the test cases).
After doing this, the snapshots are generated correctly when using `toMatchSnapshot`.
@abel-castro
Copy link
Author

Hi @nickserv! I realized there were some issues in the PR, which caused the GitHub Actions to fail. I have already fixed the problems with the latest commits. Please check it out when you have time. ;)

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.

1 participant