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

fix: test utils, only use act when in an act environment #668

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

brantphoto
Copy link
Contributor

@brantphoto brantphoto commented Apr 7, 2024

when I try to turn off act warnings via global.IS_REACT_ACT_ENVIRONMENT = false I get warnings that act is being used in a non-act environment. I took this PR's approach from from React testing library, who explicitly check for .IS_REACT_ACT_ENVIRONMENT to be true before using act.

Example:
https://github.com/testing-library/react-testing-library/blob/4e10ba3a788f6f66287dab5bb4a09f658664ec50/src/act-compat.js#L27

Copy link

vercel bot commented Apr 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-intersection-observer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2024 9:41pm

@brantphoto
Copy link
Contributor Author

looks like I have to provide a type sig for global but pending that change would you be open to this approach?

@brantphoto brantphoto force-pushed the only-use-act-in-env branch from 4c25f65 to 3c515e7 Compare April 7, 2024 21:40
Copy link

codesandbox-ci bot commented Apr 7, 2024

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.

@thebuilder
Copy link
Owner

Looks good, and makes sense!

@thebuilder thebuilder merged commit 5b7c9ff into thebuilder:main Apr 8, 2024
4 checks passed
@thebuilder
Copy link
Owner

🎉 This PR is included in version 9.8.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants