Skip to content

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

Merged
thebuilder merged 1 commit intothebuilder:mainfrom
brantphoto:only-use-act-in-env
Apr 8, 2024
Merged

fix: test utils, only use act when in an act environment#668
thebuilder merged 1 commit intothebuilder:mainfrom
brantphoto:only-use-act-in-env

Conversation

@brantphoto
Copy link
Copy Markdown
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

@vercel
Copy link
Copy Markdown

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
Copy Markdown
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
@codesandbox-ci
Copy link
Copy Markdown

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
Copy Markdown
Owner

Looks good, and makes sense!

@thebuilder thebuilder merged commit 5b7c9ff into thebuilder:main Apr 8, 2024
@thebuilder
Copy link
Copy Markdown
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