Skip to content

test: repair the extension-tests suite broken by the test/ rename - #135

Merged
LukasHirt merged 3 commits into
mainfrom
fix/extension-tests-suite
Sep 18, 2026
Merged

LukasHirt merged 3 commits into
mainfrom
fix/extension-tests-suite

Conversation

@LukasHirt

Copy link
Copy Markdown
Contributor

Summary

  • fix: integrate all ocis helper changes into the docs #119 renamed test/ to extension-tests/ (and flattened test/helpers/ into it) but left several things pointing at the old layout, so most of this suite has been silently dead ever since — always green because nothing ran:
    • package.json's test script still globbed test/*.test.js (matches nothing) → npm test ran zero tests, in CI too.
    • latest-alias.test.js, next-alias.test.js, static-files.test.js still require('./helpers/latest-versions'), which no longer exists.
    • latest-versions.js itself still walked up two directories to find content/ instead of one, so even a corrected require crashed with ENOENT.
  • Also fixes a test bug this surfaced once the suite actually started running: page-aliases.test.js walks the entire content/ tree for :page-aliases: entries, including content/ocis/8.0/, which is on disk but not in site.yml's ocis source list (only 8.1-8.3 render — site.yml's own comment says an unlisted version folder "could safely be deleted if outdated"). The test flagged that stale, never-published version as a dangling alias. Now it skips versions this build doesn't publish, matching the builtOrSkip pattern already used elsewhere in this suite.
  • Docs: fixed the same stale test/ path reference in AGENTS.md.

Found and fixed while working on #133 (the medium-zoom PR needed the suite to actually run for a new guard test to mean anything), split out here since it's unrelated to that feature.

Test plan

  • npm run antora && npm test: 51 tests run (up from 0), 50 pass, 1 skip, 0 fail.
  • Verified the ocis alias check still fails when a real published stub (8.1) is removed — it's not just skipping everything.

@LukasHirt
LukasHirt requested a review from a team as a code owner September 17, 2026 18:03
@LukasHirt LukasHirt self-assigned this Sep 17, 2026
#119 renamed test/ to extension-tests/ (and flattened test/helpers/
into extension-tests/) but left several things pointing at the old
layout: package.json's test script still globbed test/*.test.js (so
npm test silently ran zero tests, in CI too), latest-alias.test.js /
next-alias.test.js / static-files.test.js still required
./helpers/latest-versions, and latest-versions.js itself still walked
up two directories to find content/ instead of one. Net effect: most
of this suite has been dead since #119, always green because nothing
ran.

Signed-off-by: Lukas Hirt <info@hirt.cz>
Restoring npm test above turned this test back on, which surfaces it:
content/ocis/8.0 has a page-aliases entry but isn't in site.yml's ocis
source list (only 8.1-8.3 render; site.yml's own comment says an
unnamed version folder "could safely be deleted if outdated"). The
test walks the whole content/ tree, so it flagged that stale, never-
published version as a dangling alias. Skip versions this build
doesn't publish, matching the builtOrSkip pattern the rest of the
suite already uses; verified it still fails when a real published
stub (8.1) is removed.

Signed-off-by: Lukas Hirt <info@hirt.cz>
@LukasHirt
LukasHirt force-pushed the fix/extension-tests-suite branch from 67b61c2 to 7bf3ff6 Compare September 17, 2026 18:05
@LukasHirt LukasHirt changed the title fix: repair the extension-tests suite broken by the test/ rename test: repair the extension-tests suite broken by the test/ rename Sep 17, 2026
@LukasHirt
LukasHirt added this pull request to stack #136 September 17, 2026 18:07
@LukasHirt
LukasHirt removed this pull request from stack #136 September 17, 2026 18:07
oc-tmueller
oc-tmueller previously approved these changes Sep 18, 2026
@oc-tmueller
oc-tmueller added this pull request to stack #139 September 18, 2026 13:53
@oc-tmueller
oc-tmueller removed this pull request from stack #139 September 18, 2026 13:56
* feat: re-add mediumzoom as a tracked npm dependency

The previous vendored copy of medium-zoom.min.js was reverted (#131)
for missing dependency management. Install medium-zoom via npm so it
is tracked in package.json/package-lock.json (and covered by
Dependabot), and copy its prebuilt browser bundle into
ui/supplemental/js/vendor/ via a preantora/preantora-local script,
since the site has no client-side bundler of its own.

Signed-off-by: Lukas Hirt <info@hirt.cz>

* refactor: make sync-vendor-assets.js data-driven

Replace the two hardcoded copyFileSync calls with a VENDOR_FILES list,
so vendoring another package's browser build later means adding an
entry instead of writing a new script.

Signed-off-by: Lukas Hirt <info@hirt.cz>

* fix: address review on the medium-zoom vendoring approach

- Add a build-output guard (extension-tests/static-files.test.js) that
  fails loudly if ui/supplemental/js/vendor/ wasn't repopulated before
  the build (e.g. npx antora run directly, bypassing the preantora
  hook): today it publishes green with a 404'ing <script> and image
  zoom silently dead site-wide.
- Make scripts/sync-vendor-assets.js wipe js/vendor/ before
  repopulating it, so dropping an entry from VENDOR_FILES actually
  removes the stale file instead of leaving it on disk in any
  checkout that already had it.
- Narrow the CSS z-index selector to img.medium-zoom-image--opened
  (the class only the currently-zoomed clone gets) instead of the
  bare medium-zoom-image class, which stays on every bound image for
  as long as it's attached and would promote them all to z-index 1000
  the moment anything positions a doc image.
- Add `body >` to the overlay selector so our rule outranks the
  library's own .medium-zoom-overlay by specificity rather than by
  injection order, in case a future medium-zoom release adds its own
  z-index there.
- Document scripts/ and the generated ui/supplemental/js/vendor/ in
  README.md's layout tree.

Signed-off-by: Lukas Hirt <info@hirt.cz>

---------

Signed-off-by: Lukas Hirt <info@hirt.cz>
@LukasHirt
LukasHirt merged commit 696af88 into main Sep 18, 2026
4 checks passed
@LukasHirt
LukasHirt deleted the fix/extension-tests-suite branch September 18, 2026 15:34
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.

2 participants