fix(test): un-break unit CI — match island-src partial in module-load guards - #1620
Merged
Merged
Conversation
The island-fingerprinting change replaced literal bundle paths
(src="/js/tutorial-reset.js", src="/js/homepage-personalizer.js") in
head.html / baseof.html with the {{ partial "island-src.html" ... }}
fingerprinting partial. Two regression guards still asserted the old
literal src strings, so they matched null and failed on every main CI
run since #1609.
Update both regexes to accept either the fingerprinted partial form or
the literal path, while still asserting type="module" (the actual
regression intent: these Vite bundles start with import and break if
loaded as classic scripts).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Unit-test CI has failed on every
mainrun since #1609 (worktree-fingerprint-js-i…). Not transitory — two tests fail deterministically:test/unit/reset-tutorial-progress.test.js› head.html loads the tutorial-reset.js bundle as a moduletest/unit/hugo/personalizer-script-is-module.test.ts› loads /js/homepage-personalizer.js with type=moduleCI summary:
2 failed | 7842 passed.Root cause
The island-fingerprinting work (#1609/#1611) replaced the literal bundle paths in the Hugo templates with the fingerprinting partial:
baseof.html:71src="/js/homepage-personalizer.js"src="{{ partial \"island-src.html\" \"homepage-personalizer\" }}"head.html:160src="/js/tutorial-reset.js"src="{{ partial \"island-src.html\" \"tutorial-reset\" }}"Both regression guards still asserted the old literal src against the raw template source, so the regex matched
null. Thetype="module"attribute the tests actually care about is still present in both templates — pure test staleness, not a production regression.Fix
Update both regexes to accept either the fingerprinted partial form or the literal path, while still asserting
type="module"(the real regression intent: these Vite bundles begin withimportand break if loaded as classic scripts).Swept
test/for any other literalsrc="/js/*.js"guards against island-src-migrated templates — none remain.Verification
reset-tutorial-progress.test.js→ 44/44 passpersonalizer-script-is-module.test.ts→ 1/1 pass