ssr-effects.ts (472B)
1 import { vi } from 'vitest'; 2 3 // Node has no window or document; ordinary feature detection remains safe. 4 // Imports and server rendering must not acquire browser capabilities or egress. 5 for (const name of ['indexedDB', 'WebSocket', 'nostr']) { 6 Object.defineProperty(globalThis, name, { 7 configurable: true, 8 get() { 9 throw new Error(`SSR accessed ${name}`); 10 } 11 }); 12 } 13 vi.stubGlobal('fetch', () => { 14 throw new Error('SSR attempted network access'); 15 });