23 lines
904 B
JavaScript
23 lines
904 B
JavaScript
const { JSDOM } = require("jsdom");
|
|
const dom = new JSDOM(`<!DOCTYPE html><html><body><div id="status-message"></div></body></html>`);
|
|
global.window = dom.window;
|
|
global.document = dom.window.document;
|
|
global.navigator = dom.window.navigator;
|
|
global.location = dom.window.location;
|
|
global.localStorage = { getItem: () => null, setItem: () => null, removeItem: () => null };
|
|
global.fetch = () => Promise.resolve({ ok: true, json: () => Promise.resolve({}) });
|
|
global.$ = (id) => document.getElementById(id) || document.createElement('div');
|
|
global.toast = () => {};
|
|
global.escapeHtml = () => '';
|
|
global.escHtml = () => '';
|
|
global.debounce = () => {};
|
|
global.audiobookIsChapter = () => false;
|
|
global.initCloneSampleText = () => {};
|
|
|
|
try {
|
|
require('../static/dist/main.min.js');
|
|
console.log("Bundle executed successfully without top-level errors!");
|
|
} catch (e) {
|
|
console.error("Bundle error:", e);
|
|
}
|