Repository navigation
test(preview): check the gallery page writeIndex writes - #280
Merged
juancguerrerodev merged 11 commits intoDec 6, 2026
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
…ngLabs#264) Signed-off-by: Ashiq Hussain Mir <128612922+mir-ashiq@users.noreply.github.com>
juancguerrerodev
force-pushed
the
test/preview-gallery-index
branch
from
December 6, 2026 09:11
75da32b to
d991a54
Compare
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.
What and why
Closes #268
Adds
apps/mobile/preview/gallery.test.mjs(node:test, likebrowser.test.mjsandpick.test.mjs) and adds it to thetestscript inapps/mobile/preview/package.json. Each test callswriteIndexwith made-up shots (withid,name,route,variant,theme,lang,fileanderrors) on a path in a fresh folder frommkdtempSync(join(tmpdir(), "hermit-gallery-")), readsindex.htmlback, and removes the folder at the end.gallery.mjsis unchanged. No Chromium and no build:writeIndexonly writes a file, and the four test files import only node built-ins and local files.What the tests cover:
id,nameandvariantshare one<section>(one figure each, under one heading); a shot with a differentvariantgets its own section, with the state named.nameand anotewith<,>,&and"come out escaped in the heading, the meta line and the alt text, and no raw<script>from a shot's text reaches the page.errorsis not empty, carrying the errors in its title attribute.full, pointing at the full picture.mockups/<mockup>exists next to the index file: one case creates it in the temp folder, another leaves it out.Vision fit
Contributor tools that work (AGENTS.md, "Screenshots for a UI change"): the page people use to look through the shots after a preview run is now checked without a browser, so a regression in grouping, escaping, the error badge or the mockup is caught by
pnpm testin seconds.Non-negotiables
Checklist
acceptedproposal.pnpm check:privacy,pnpm typecheck,pnpm lint,pnpm testandnode scripts/guard/check.mjs --patterns scripts/guard/patterns.txt.packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes.On the gates: this is a test-only change to
apps/mobile/preview, and I could not run the whole workspace's gates on this machine (the disk is nearly full, so a fullpnpm installof every workspace package was not possible). What I did run, exactly:cd apps/mobile/preview && pnpm install --ignore-workspace(pnpm 10.15.1 through Corepack; the lockfile is untouched, and the test files import no dependencies)node --test gallery.test.mjs— the new file, 5 tests, all passingpnpm testinapps/mobile/preview— 31 tests acrossdevice-lab.test.mjs,browser.test.mjs,pick.test.mjsand the newgallery.test.mjs, all passingnode scripts/check-privacy.mjs— "privacy: no analytics, crash reporting or login brokers found"node scripts/guard/check.mjs --patterns scripts/guard/patterns.txt— "guard: ok"Each of the five tests was broken on purpose to watch it fail before being put back (expecting three sections, expecting a raw
<script>on the page, expecting two "console errors" badges, expecting two "full length" links, and expecting the mockup figure with no mockup file): each broken expectation failed exactly its own test, and the restored file passes. What I did not run: the full-workspacepnpm typecheck,pnpm lintandpnpm testfor the other packages, which this change doesn't touch (apps/mobileisn't linted yet per CONTRIBUTING.md; the change adds one file and one line inpackage.jsonunderapps/mobile/preview).On #227: it landed before this pull request, so
pick.test.mjswas already in thetestscript and both files stay in the list.Model path
packages/model,agent,skillsoreval, the prompt, the router, tool descriptions, normalizers, examples or the model file.Screenshots
New dependencies and network calls
n/a
AI agents
gallery.mjsand the neighbouringbrowser.test.mjs/pick.test.mjs, ran the package's tests, broke each expectation to watch it fail, and put it back. The claim comment on the issue was posted from the mir-ashiq account this branch is pushed from.