0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-15 13:18:48 +02:00
gitea/web_src/js/vitest.setup.ts

30 lines
918 B
TypeScript

// Stub APIs not implemented by happy-dom but needed by dependencies
// XPathEvaluator is used by htmx at module evaluation time
// TODO: Remove after https://github.com/capricorn86/happy-dom/pull/2103 is released
if (!globalThis.XPathEvaluator) {
globalThis.XPathEvaluator = class {
createExpression() { return {evaluate: () => ({iterateNext: () => null})} }
} as any;
}
// Dynamic import so polyfills above are applied before htmx evaluates
await import('./globals.ts');
window.config = {
appUrl: 'http://localhost:3000/',
appSubUrl: '',
assetUrlPrefix: '/assets',
sharedWorkerUri: '',
runModeIsProd: true,
customEmojis: {},
pageData: {},
notificationSettings: {MinTimeout: 0, TimeoutStep: 0, MaxTimeout: 0, EventSourceUpdateTime: 0},
enableTimeTracking: true,
mermaidMaxSourceCharacters: 5000,
i18n: {},
};
window.testModules = {};
export {}; // mark as module for top-level await