You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[quality] scripts/html-pages.mjs page-discovery helper has no direct unit test — gates can pass vacuously #178
scripts/html-pages.mjs exports htmlFiles(), isRedirectPage(), lineOf() and SKIP_DIRS. Ten static gates (page-meta, page-csp, page-images, page-markup, page-structure, page-404, page-scripts, jsonld-contract, redirect-targets, ci-wiring) import it to decide which pages they inspect — but no test exercises the helper itself.
The failure mode is silent: if SKIP_DIRS gained a content directory (e.g. stories), or the walker stopped recursing, or isRedirectPage() stopped matching the generator's <meta http-equiv="refresh">, no gate would fail — each would simply run over fewer pages and pass vacuously. Mutation check at 6e7faba: each of those three edits leaves node --test scripts/*.test.mjs fully green today.
This is the same class of gap #177 closed for scripts/actions-if.mjs.
Evidence: unit — node --test scripts/*.test.mjs @ 6e7faba: 537 pass, 0 direct tests for html-pages.mjs (grep -l 'html-pages.mjs' scripts/*.test.mjs → importers only). End-to-end — the links.ymltest job runs the same glob, so it inherits the same blind spot; no separate e2e coverage source exists for this repo.
Recommendation
Add scripts/html-pages.test.mjs (direct unit test, zero dependencies, fits the existing node --test scripts/*.test.mjs glob so no workflow edit is needed):
htmlFiles() on a temp tree: recursion, sorted output, .html-only (not .htm/.HTML/.html.bak), skips exactly SKIP_DIRS at any depth and only as directories, [] on empty tree
SKIP_DIRS equals the known tooling set and never names a content directory
isRedirectPage() positive variants (quote style, case, whitespace around =, attribute order, multi-line) and negatives (CSP / content-type http-equiv, name="refresh", prose)
lineOf() 1-based semantics
live-tree pins: index.html, 404.html, stories/index.html and every make-redirects.sh MAP page are discovered; nothing under a skipped dir is; redirect pages == MAP paths
README ## Checks entry (required by ci-wiring.test.mjs)
Priority
Impact: medium (guards the non-vacuity of every other page gate)
Activity
test: unit-test the page-discovery helper in scripts/html-pages.mjs (#…