()
| 86 | } |
| 87 | |
| 88 | function warnOnMissingSetup() { |
| 89 | if (isMocking()) return; |
| 90 | console.error( |
| 91 | `React Intersection Observer was not configured to handle mocking. |
| 92 | Outside Jest and Vitest, you might need to manually configure it by calling setupIntersectionMocking() and resetIntersectionMocking() in your test setup file. |
| 93 | |
| 94 | // test-setup.js |
| 95 | import { resetIntersectionMocking, setupIntersectionMocking } from 'react-intersection-observer/test-utils'; |
| 96 | |
| 97 | beforeEach(() => { |
| 98 | setupIntersectionMocking(vi.fn); |
| 99 | }); |
| 100 | |
| 101 | afterEach(() => { |
| 102 | resetIntersectionMocking(); |
| 103 | });`, |
| 104 | ); |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Create a custom IntersectionObserver mock, allowing us to intercept the `observe` and `unobserve` calls. |
no test coverage detected
searching dependent graphs…