Files
Creeer-Web/vitest.setup.ts
T

20 lines
564 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import '@testing-library/jest-dom/vitest';
// jsdom lacks IntersectionObserver; Framer Motion's `whileInView` needs it.
if (typeof window !== 'undefined' && !('IntersectionObserver' in window)) {
class IntersectionObserverStub {
observe() {}
unobserve() {}
disconnect() {}
takeRecords() {
return [];
}
root = null;
rootMargin = '';
thresholds = [];
}
// @ts-expect-error – installing stub on window
window.IntersectionObserver = IntersectionObserverStub;
global.IntersectionObserver = IntersectionObserverStub;
}