/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/sync-core/setupVitest.js
44 строки
1 KB
Kevin Ingersoll
chore(deps): bump jsdom to v29 (#9019)
05 июн 2026, 14:47
Не верифицирован
05 июн 2026, 14:47
4a316fd
Код
Авторство
О чём код?
// IndexedDB polyfill for browser storage testing require('fake-indexeddb/auto') // ResizeObserver polyfill for DOM observation testing global.ResizeObserver = require('resize-observer-polyfill') // Crypto polyfill for cryptographic operations global.crypto ??= new (require('@peculiar/webcrypto').Crypto)() // FontFace API polyfill for font testing global.FontFace = class FontFace { load() { return Promise.resolve() } } // Document fonts API mock document.fonts = { add: () => {}, delete: () => {}, forEach: () => {}, } // jsdom ships a global WebSocket built on its bundled copy of undici. In this jsdom test // environment its events are created in a different realm than the Node EventTarget they're // dispatched on, so connecting throws "The 'event' argument must be an instance of Event". Use // the `ws` package's WebSocket for client connections instead, matching the WebSocketServer the // tests connect to. global.WebSocket = require('ws').WebSocket // Window.matchMedia polyfill for media queries Object.defineProperty(window, 'matchMedia', { writable: true, value: (query) => ({ matches: false, media: query, onchange: null, addListener: () => {}, removeListener: () => {}, addEventListener: () => {}, removeEventListener: () => {}, dispatchEvent: () => {}, }), })