Skip to content

[2/5] test: harden the build-output assertions - #1110

Merged
AvdLee merged 2 commits into
AvdLee:masterfrom
ralph-cmyk:test/harden-build-output-tests
Jul 27, 2026
Merged

[2/5] test: harden the build-output assertions#1110
AvdLee merged 2 commits into
AvdLee:masterfrom
ralph-cmyk:test/harden-build-output-tests

Conversation

@ralph-cmyk

@ralph-cmyk ralph-cmyk commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Merge order 2 of 5 — hardens the test harness introduced in #1105; merge right after it. Shows #1105's commits until that merges — the diff on top is tests/build-output.test.js only. I will rebase after each merge.

Problem. The build-output tests added in #1105 have four blind spots: the
video-deferral check counts preload="none" anywhere on the page rather than
on each video tag, the .jpg-reference scan covers only the homepage, an
empty poster folder passes the WebP check, and the payload guard is a frozen
byte total that falsely fails the moment a poster is legitimately added.

Why it matters. These tests are the CI guard that keeps the poster
optimization from silently regressing. A guard that can be masked by an
unrelated string, or that only watches 1 of 106 built pages, protects less
than it appears to.

What changed. tests/build-output.test.js only. Assertions are now
per-video-tag, scan every built HTML page, require at least 13 WebP posters
to exist, and cap each poster at 110 KB instead of freezing a directory
total. readDist uses fileURLToPath so checkouts with spaces in the path
work.

KPI — starting point. Measured by mutation testing on the built site
(25 Jul 2026): removing preload="none" from one video while the literal
string appears in an inline script passes the old assertion; the .jpg scan
covers 1 of 106 built pages; an empty posters/ directory passes the WebP
check.

KPI — expectation. The same mutations now fail the suite (verified before
opening this PR). No behavior change to the site itself — dist/ output is
byte-identical.

How to measure it. npm test after npm run build. To reproduce the
mutation check: strip a preload="none" from one <video> tag in
dist/index.html and re-run — the suite must go red.

Risk / rollback. Test-only change; the site does not change. If an
assertion proves too strict, revert this single commit — #1105's original
tests remain the fallback.

The deferral check counted preload=none globally, so a stray string
elsewhere could mask an eager video; the .jpg scan covered only the
homepage of 106 built pages; an empty poster folder passed; and the
frozen byte baseline would falsely fail when a poster is legitimately
added. Assertions are now per-video-tag, all-pages, presence-checked,
and per-poster (110KB cap), with fileURLToPath for path safety.
@ralph-cmyk ralph-cmyk changed the title test: harden the build-output assertions [2/5] test: harden the build-output assertions Jul 25, 2026
@AvdLee
AvdLee marked this pull request as ready for review July 27, 2026 12:34
AvdLee added a commit to ralph-cmyk/RocketSimApp that referenced this pull request Jul 27, 2026
Rebased onto master (now includes the AvdLee#1109 retitle) and onto the
hardened test harness from AvdLee#1110. The FAQ block and its test are
unchanged in substance from the original branch.
@AvdLee
AvdLee merged commit 7fd0beb into AvdLee:master Jul 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants