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

feat: restore beforeEach in test utils #715

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Conversation

thebuilder
Copy link
Owner

This PR changes to test-utils, to ensure mocking is configured in a reliable manner when using Jest

  • Add back beforeEach to trigger the automatic mocking. This was removed in Does not recognise Vitest 2 inside beforeAll hook #689
  • Keep the beforeAll hook
  • Add a check to setupIntersectionMocking method, so it only runs if mocking hasn't been set up
  • Introduce a destroyIntersectionMocking method to clear all mocking, and revert to the browser implementation

Closes #699

- Add back `beforeEach` to trigger the automatic mocking.
- Keep the `beforeAll` hook
- Add a check to `setupIntersectionMocking` method, so it only runs if mocking hasn't been set up
- Introduce a `destroyIntersectionMocking` method to clear all mocking, and revert to the browser implementation
Copy link

stackblitz bot commented Jan 14, 2025

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

vercel bot commented Jan 14, 2025

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 Jan 14, 2025 9:44am

Copy link

pkg-pr-new bot commented Jan 14, 2025

npm i https://pkg.pr.new/thebuilder/react-intersection-observer@715

commit: 18de17e

@thebuilder thebuilder merged commit f098c1e into main Jan 14, 2025
15 checks passed
@thebuilder thebuilder deleted the feat/restore-beforeach branch January 14, 2025 09:49
@thebuilder
Copy link
Owner Author

🎉 This PR is included in version 9.15.0 🎉

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.

Version >= 9.12.0 breaks automatic InteractionOberserver setup with jest
1 participant