1
0
forked from rosa/hakurei

17 Commits

Author SHA1 Message Date
Kat
a4f7756b67 TODO: docs maybe?? 2026-03-23 07:01:19 +11:00
Kat
9c18cc2d48 TODO: actually write tests lol 2026-03-23 07:01:19 +11:00
Kat
0097bdd525 TODO: relocate test code 2026-03-23 07:01:19 +11:00
Kat
04af503e40 cmd/pkgserver: aria-describe test node summary with state
The summary marker does not appear in the AOM, so setting its alt text
is fruitless.
2026-03-23 07:01:19 +11:00
Kat
d7154e7157 cmd/pkgserver: provide role descriptions for test nodes in web UI 2026-03-23 07:01:19 +11:00
Kat
8314da68c2 cmd/pkgserver: fix dark mode in test web UI 2026-03-23 07:01:19 +11:00
Kat
764ad34a2f cmd/pkgserver: serialize JS enums as ints instead of strings 2026-03-23 07:01:19 +11:00
Kat
2a1cde7896 cmd/pkgserver: set exit code when running JS tests from CLI 2026-03-23 07:01:19 +11:00
Kat
87ab8d6180 cmd/pkgserver: expose verbose StreamReporter flag via CLI 2026-03-23 07:01:19 +11:00
Kat
9abfbc95b8 cmd/pkgserver: implement skipping JS tests from the DSL 2026-03-23 07:01:19 +11:00
Kat
1ce22a56b5 cmd/pkgserver: allow non-global JS test suites 2026-03-23 07:01:19 +11:00
Kat
8dbb1659bf cmd/pkgserver: serialize raw log list for go test consumption 2026-03-23 07:01:19 +11:00
Kat
ad49e4538b cmd/pkgserver: add JSON reporter to facilitate go test integration 2026-03-23 07:01:19 +11:00
Kat
6da5d5a58a cmd/pkgserver: fix multi-line JS test output display 2026-03-23 07:01:19 +11:00
Kat
61f2837388 cmd/pkgserver: implement JS test DSL and runner 2026-03-23 07:01:19 +11:00
Kat
32e5235359 cmd/pkgserver: move StreamReporter display() to Reporter interface 2026-03-23 07:01:19 +11:00
Kat
9624c224b8 cmd/pkgserver: add DOM reporter for JS tests 2026-03-23 07:01:19 +11:00

View File

@@ -281,8 +281,10 @@ export class StreamReporter implements Reporter {
} }
} }
function throwNotInDOMError(id: string): never { function assertGetElementById(id: string): HTMLElement {
throw new ReferenceError(`element with ID '${id}' missing from DOM`); let elem = document.getElementById(id);
if (elem == null) throw new ReferenceError(`element with ID '${id}' missing from DOM`);
return elem;
} }
export class DOMReporter implements Reporter { export class DOMReporter implements Reporter {
@@ -291,16 +293,12 @@ export class DOMReporter implements Reporter {
update(path: string[], result: TestResult) { update(path: string[], result: TestResult) {
if (path.length === 0) throw new RangeError("path is empty"); if (path.length === 0) throw new RangeError("path is empty");
if (result.state === "skip") { if (result.state === "skip") {
const text = document.getElementById("skip-counter-text"); assertGetElementById("skip-counter-text").classList.remove("hidden");
if (!text) throwNotInDOMError("skip-counter-text");
text.classList.remove("hidden");
} }
const counter = document.getElementById(`${result.state}-counter`); const counter = assertGetElementById(`${result.state}-counter`);
if (!counter) throwNotInDOMError(`${result.state}-counter`);
counter.innerText = (Number(counter.innerText) + 1).toString(); counter.innerText = (Number(counter.innerText) + 1).toString();
let parent = document.getElementById("root"); let parent = assertGetElementById("root");
if (!parent) throwNotInDOMError("root");
for (const node of path) { for (const node of path) {
let child: HTMLDetailsElement | null = null; let child: HTMLDetailsElement | null = null;
let summary: HTMLElement | null = null; let summary: HTMLElement | null = null;