0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-30 19:41:46 +01:00
posthog/jest.setup.ts

14 lines
443 B
TypeScript
Raw Normal View History

import 'whatwg-fetch'
import 'jest-canvas-mock'
import { TextEncoder, TextDecoder } from 'util'
// Jest/JSDom don't know about TextEncoder but the browsers we support do
// https://github.com/jsdom/jsdom/issues/2524
global.TextDecoder = TextDecoder
global.TextEncoder = TextEncoder
window.scrollTo = jest.fn()
2023-08-16 16:06:09 +02:00
window.matchMedia = jest.fn(
() => ({ matches: false, addListener: jest.fn(), removeListener: jest.fn() } as MediaQueryList)
)