From eb4e1e733f2ebce6e4b3f350cd3834482df86a30 Mon Sep 17 00:00:00 2001 From: Derek Lewis Date: Sat, 8 Aug 2026 04:15:41 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=EF=B8=8F=F0=9F=94=A7=EF=BC=9Asay?= =?UTF-8?q?=20which=20verify=20task=20failed,=20and=20why=20vnu=20had=20no?= =?UTF-8?q?thing=20to=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Running `nps test` in a fresh clone ends in a two-hundred-line vnu usage page and a bare exit 1, with no indication of which of the thirteen tasks produced it. Two separate problems. vnu prints its whole manual when handed no files, and it gets no files when _site does not exist -- which is the normal state of a clone nobody has built yet. CI never sees this because Build runs before Test. The task now says so in one line instead. And verify.all ran the tasks without naming them, so any failure had to be inferred from whichever tool's output looked wrong. It now announces each task as it starts and lists the failures at the end. Before: NAME vnu - The Nu Html Checker ... 200 lines ... failed with exit code 1 After: ==> build/tasks/verify/verify-html-valid-for-vnu.mts No HTML under _site/ to check. Run `nps build` first. FAILED: build/tasks/verify/verify-html-valid-for-vnu.mts Co-Authored-By: Claude Opus 5 --- build/tasks/verify/verify-html-valid-for-vnu.mts | 8 ++++++++ package-scripts.yml | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/build/tasks/verify/verify-html-valid-for-vnu.mts b/build/tasks/verify/verify-html-valid-for-vnu.mts index 7d2b49d70..ae248b50b 100644 --- a/build/tasks/verify/verify-html-valid-for-vnu.mts +++ b/build/tasks/verify/verify-html-valid-for-vnu.mts @@ -10,6 +10,14 @@ import vnu from 'vnu-jar'; const htmlFiles = await glob(['_site/**.html', '!node_modules/']); +// vnu responds to being given no files by printing its entire usage page and +// exiting non-zero, which buries the actual problem: this task checks the +// built site, and there is nothing built to check. +if (htmlFiles.length === 0) { + console.error('No HTML under _site/ to check. Run `nps build` first.'); + process.exit(1); +} + let exitCode = 0; const scripts = [`java -jar ${vnu} ${htmlFiles.join(' ')}`]; diff --git a/package-scripts.yml b/package-scripts.yml index ead81be52..2f37c1de6 100644 --- a/package-scripts.yml +++ b/package-scripts.yml @@ -6,7 +6,10 @@ scripts: buildStyles: tsx build/tasks/compile/build-styles.mts siteifyHealthFiles: tsx build/tasks/compile/siteify-health-files.mts verify: - all: 'rc=0; for i in build/tasks/verify/*.mts; do tsx "$i" || rc=1; done; exit $rc' + # Announces each task and names the ones that failed. Without this the + # output is a wall of tool chatter with no indication of which of the + # thirteen produced it. + all: 'rc=0; failed=; for i in build/tasks/verify/*.mts; do echo "==> $i"; tsx "$i" || { rc=1; failed="$failed $i"; }; done; [ -z "$failed" ] || echo "FAILED:$failed" >&2; exit $rc' browserslist: tsx build/tasks/verify/verify-browserslist.mts scss: tsx build/tasks/verify/verify-scss.mts dockerfile: tsx build/tasks/verify/verify-dockerfile.mts