14 lines
473 B
TypeScript
14 lines
473 B
TypeScript
import '@testing-library/jest-dom/vitest';
|
|
|
|
// Vitest preserves Node 26's host storage globals when populating jsdom.
|
|
// Bind the actual jsdom Storage objects, not the unavailable host storage.
|
|
const browserWindow = (globalThis as typeof globalThis & {
|
|
jsdom: { window: Window };
|
|
}).jsdom.window;
|
|
for (const name of ['localStorage', 'sessionStorage'] as const) {
|
|
Object.defineProperty(globalThis, name, {
|
|
configurable: true,
|
|
value: browserWindow[name],
|
|
});
|
|
}
|