// jsdom has no layout: give the few APIs the editor touches harmless defaults. if (!('scrollIntoView' in Element.prototype)) (Element.prototype as any).scrollIntoView = () => {} // This jsdom runs origin-less, so there is no localStorage: provide an // in-memory one so UI persistence (rail/panel state) behaves like a browser. if (typeof (globalThis as any).localStorage === 'undefined') { const store = new Map() ;(globalThis as any).localStorage = { getItem: (k: string) => (store.has(k) ? store.get(k)! : null), setItem: (k: string, v: string) => void store.set(k, String(v)), removeItem: (k: string) => void store.delete(k), clear: () => store.clear(), key: (i: number) => [...store.keys()][i] ?? null, get length() { return store.size }, } } ;(globalThis as any).IS_REACT_ACT_ENVIRONMENT = true // Store updates arrive from fetch/timers outside act(); the harness settles them explicitly. const error = console.error console.error = (...a: unknown[]) => { if (typeof a[0] === 'string' && a[0].includes('not wrapped in act')) return error(...a) }