MCPcopy Index your code
hub / github.com/thebuilder/react-intersection-observer / warnOnMissingSetup

Function warnOnMissingSetup

src/test-utils.ts:88–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88function warnOnMissingSetup() {
89 if (isMocking()) return;
90 console.error(
91 `React Intersection Observer was not configured to handle mocking.
92Outside 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
95import { resetIntersectionMocking, setupIntersectionMocking } from 'react-intersection-observer/test-utils';
96
97beforeEach(() => {
98 setupIntersectionMocking(vi.fn);
99});
100
101afterEach(() => {
102 resetIntersectionMocking();
103});`,
104 );
105}
106
107/**
108 * Create a custom IntersectionObserver mock, allowing us to intercept the `observe` and `unobserve` calls.

Callers 3

mockAllIsIntersectingFunction · 0.85
mockIsIntersectingFunction · 0.85
intersectionMockInstanceFunction · 0.85

Calls 1

isMockingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…