test: LibreOffice, the layout lint and a monkey read the editor's work back

lo-fuzz.test.ts hands every fuzz seed to LibreOffice as .odt and .docx and
compares what comes back, listing the differences LibreOffice makes by design.
test:layout opens the corpus, the showcase and fuzz seeds in the browser, holds
the page count against LibreOffice and checks the lines for overlap, margin
escapes and stranded headings. test:monkey types at random on corpus documents
and asserts the schema, undo to the start, redo, and that both saved formats
read back. browser.mjs now carries the dev server and the settle helper.
This commit is contained in:
Steffen Becker committed 2026-09-06 19:07:16 +02:00
1 parent 3b6cb06e6f
commit d156482a3f
14 files changed
+874 -177

No files matched your search

+2 -12
View File
@@ -2,27 +2,17 @@
// modules are TypeScript the browser imports straight from the dev server, and the app's
// own exporters write the .odt/.docx; each is then opened through the file input and shot.
// `node scripts/showcase/run.mjs [regex]` limits the run to matching document names.
import { spawn } from 'node:child_process';
import { writeFile, mkdir } from 'node:fs/promises';
import { join } from 'node:path';
import { ROOT, openApp } from '../../tests/browser.mjs';
import { ROOT, openApp, devServer } from '../../tests/browser.mjs';
const PORT = 4187;
const OUT = join(ROOT, 'docs/showcase');
const only = process.argv[2] ? new RegExp(process.argv[2]) : null;
const DOCS = ['thesis', 'thesis-review', 'book', 'newsletter'].filter((n) => !only || only.test(n));
async function devServer() {
const up = () => fetch(`http://localhost:${PORT}/`).then(() => true).catch(() => false);
if (await up()) return null;
const proc = spawn('npx', ['vite', '--port', String(PORT), '--strictPort'],
{ cwd: ROOT, stdio: 'ignore', detached: true });
for (let i = 0; i < 60 && !(await up()); i++) await new Promise((r) => setTimeout(r, 500));
return proc;
}
await mkdir(OUT, { recursive: true });
const server = await devServer();
const server = await devServer(PORT);
const { browser, page, pageErrors } = await openApp(PORT);
const url = `http://localhost:${PORT}/`;