d1861ec5d9
- Bridge jsdom localStorage/sessionStorage over Node 22+'s experimental globals that vitest's jsdom environment doesn't override - Update Greek lookup tests to mock the OpenScriptures Strong's dictionary instead of the retired bolls.life path - Update migrateChunk no-op test for backfilled fields - Match en-dash verse range labels in chunk creation test - Untrack .api.log/.api.pid and gitignore them Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
19 lines
693 B
JavaScript
19 lines
693 B
JavaScript
import '@testing-library/jest-dom';
|
|
|
|
// Node 22+ defines experimental localStorage/sessionStorage globals that are
|
|
// undefined unless --localstorage-file is passed. Vitest's jsdom environment
|
|
// skips copying window keys that already exist on the Node global, so jsdom's
|
|
// storage objects get shadowed. Bridge them from the raw jsdom instance.
|
|
const jsdomWindow = globalThis.jsdom?.window;
|
|
if (jsdomWindow) {
|
|
for (const key of ['localStorage', 'sessionStorage']) {
|
|
if (typeof globalThis[key] === 'undefined' && jsdomWindow[key]) {
|
|
Object.defineProperty(globalThis, key, {
|
|
value: jsdomWindow[key],
|
|
writable: true,
|
|
configurable: true,
|
|
});
|
|
}
|
|
}
|
|
}
|