test: zero-dependency harness for userscript adapter logic
Loads the IIFE in bare Node behind a minimal localStorage/document stub, with document.body left undefined so the boot block defers and the UI never builds. Adds a module.exports hook that is inert in every real userscript engine. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1357,6 +1357,18 @@
|
||||
.toast.err { background: #7f1d1d; }
|
||||
`;
|
||||
|
||||
// ============================================================
|
||||
// Test hook
|
||||
//
|
||||
// Node's require() defines `module`; Bromite's native engine, Tampermonkey,
|
||||
// and Violentmonkey do not, so this is inert everywhere the script actually
|
||||
// ships. Exposes pure logic only — see userscript/test/logic.test.js, which
|
||||
// loads this file with document.body undefined so the UI never boots.
|
||||
// ============================================================
|
||||
if (typeof module === "object" && module.exports) {
|
||||
module.exports = { stripBuildHash, asura, demonic, anchorsFromHTML, statusOf };
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Boot — MUST run last: init() -> buildUI() reads TEMPLATE/CSS,
|
||||
// which are const (TDZ) and only initialized above. At
|
||||
|
||||
Reference in New Issue
Block a user