Skip to content

fix(ci): repair 3 pre-existing DEV unit-test breakages - #3039

Merged
jung-thomas merged 1 commit into
DEVfrom
worktree-fix-dev-unit-breakages
Nov 6, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
worktree-fix-dev-unit-breakages

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Follow-up to #3036 (merged), which fixed the bundle-step crash. With that unblocked, the unit job ran and surfaced 3 independent pre-existing breakages on DEV (all present on the pre-#3036 DEV baseline — not introduced by #3036). This PR fixes all three so the unit job goes green.

1. Hugo build broken — contains is not a Hugo function

hugo/layouts/shortcodes/tut-menu.html:21 used contains . "→". contains is not a Go-template/Hugo function; the operands are both strings, so this is a substring test → strings.Contains. The parse error failed the Hugo build (exit 1), cascading to 4 failures in hugo-homepage-partials.test.ts (homepage, /learn/, tutorial-navigator, featured-missions never built). Introduced by the new-file commit 8c2028daa.

2. srv-qa parsers.bundle — duplicate createRequire declaration

prebuild:parsers-bundle (package.json) injected a banner with the bare createRequire, colliding with esbuild-emitted import { createRequire } from 'node:module' carried in from scripts/parsers/directives/ui.ts + reference-links.ts → SyntaxError: Identifier 'createRequire' has already been declared (surfaced as an oxc vite:define transform error), failing 5 srv-qa test files at module load. Fix: use the aliased banner createRequire as __cjsBundleRequire — the exact convention scripts/bundle-shared.cjs already documents and uses for the sibling bundles.

3. Stale test assertions vs. the intentional callout/alert refactor

Commits 18e713de5 (CSS) and 71a8d70bc (render hook) deliberately moved alerts to <aside>/<details> rendered via the tut-alert.html partial, and broadened the CSS sibling rule to ~ :is(blockquote, aside, details). Three string-matching tests were left behind (source is correct):

  • option-codeblock-indent-css.test.ts: ~ blockquote → ~ :is(blockquote, aside, details).
  • option-tail-leak.test.ts: blockquote.alert-tip → aside.alert.alert-tip (the real rendered element).
  • render-blockquote-hook.test.ts: assert the hook delegates to tut-alert.html passing .AlertType, and that the partial emits class="alert alert-{{ $type }}" — preserving the coverage intent against the new architecture.

Verification

🤖 Generated with Claude Code

1. hugo/layouts/shortcodes/tut-menu.html: `contains` is not a Hugo
   function; the operands are strings → use `strings.Contains`. The bad
   token broke the Hugo build (exit 1), cascading to 4 hugo-homepage-partials
   failures (#8c2028daa).
2. package.json prebuild:parsers-bundle: align esbuild banner with the
   aliased `createRequire as __cjsBundleRequire` convention already used by
   bundle-shared.cjs. The bare `createRequire` collided with esbuild-emitted
   createRequire imports (from directives/ui.ts + reference-links.ts),
   throwing SyntaxError at module-load for 5 srv-qa test files.
3. Update 3 stale test assertions to match the intentional callout refactor
   (#18e713de5, #71a8d70bc): alerts now render as <aside>/<details> via the
   tut-alert partial and the CSS sibling rule broadened to
   `~ :is(blockquote, aside, details)`. Tests, not source, were behind.
@jung-thomas
jung-thomas merged commit 5dd2f3b into DEV Nov 6, 2026
6 of 7 checks passed
@jung-thomas
jung-thomas deleted the worktree-fix-dev-unit-breakages branch November 6, 2026 18:55
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.

1 participant