Skip to content

Upgrade dashboard to Astro 7 and add a real test suite#5

Merged
DustinVK merged 3 commits into
mainfrom
wherefore/astro-7-upgrade
Jul 4, 2026
Merged

Upgrade dashboard to Astro 7 and add a real test suite#5
DustinVK merged 3 commits into
mainfrom
wherefore/astro-7-upgrade

Conversation

@DustinVK

@DustinVK DustinVK commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Upgrades @dustinvk/wherefore-dashboard to Astro 7 (0.2.0) and replaces the shallow "does the file exist" checks with a test suite that asserts the dashboard actually renders correctly.

  • Astro 7 upgrade (0.2.0): bump astro ^5.0.0^7.0.0. Astro 7 requires a newer Node, so the package engines floor and the CI Node version are raised accordingly. Minor bump since raising the required Node engine is breaking for consumers on older Node. The per-run content-store reset (the duplicate-id fix) still holds.
  • Real test suite: unit tests for the pure body/topics parsers (importing the TS sources via Node's native type stripping) plus jsdom integration tests over a real build of the fixtures — summary math, active-vs-retired filtering, supersede/obsolete callouts and back-links, chips/body/inline-markdown rendering, question open/resolved states, tag counts that exclude retired entries, and the client-side filter scripts (resolved tab, search, retired toggle, ?area= URL param).
  • Bug caught and fixed: the homepage open-questions list rendered q.data.id (stripped by the questions schema), so the Q-ID showed blank; now uses q.id like the questions page.
  • Code-review follow-ups: raise the Node floor to ^22.18.0 || >=24.0.0 (so native TS type stripping and jsdom both work), run a [22.18, 24] CI matrix, auto-discover tests via node --test with serialized execution to avoid the shared Astro cache race, assert build status in the before() hook, make the ?area= test actually discriminating, and extract shared scaffolding into tests/helpers.mjs.

Tests and fixtures stay out of the npm package (verified via npm pack --dry-run: 22 files, unchanged). All 30 tests pass.

Test plan

  • node --test — all 30 tests pass
  • Full build against a real wherefore renders every page with correct content and no deprecation warnings
  • npm pack --dry-run confirms tests/helpers/jsdom excluded (22 files)

🤖 Generated with Claude Code

DustinVK and others added 3 commits July 3, 2026 14:26
Bump astro ^5.0.0 -> ^7.0.0. Astro 7 requires Node >=22.12.0, so raise the
package engines from >=18 and the CI workflow's Node from 20 to 22.

Verified against Astro 7.0.6: all 11 tests pass; full build against a real
wherefore renders every page (index, log, log/[slug], questions, tags) with
correct content and no deprecation warnings; dev server serves correctly;
and the per-run content-store reset still works (the data-store location is
unchanged in Astro 7), so the duplicate-id fix is intact.

Minor bump (0.2.0) since raising the required Node engine is a breaking
change for consumers on Node 18-21.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The existing tests only checked CLI exit codes and that output files exist.
This adds tests that assert the dashboard actually renders correctly.

- Unit tests for the pure body/topics parsers (entry-sections, topics),
  importing the TS sources directly via Node's native type stripping.
- jsdom integration tests over a real build of the fixtures: summary-line
  math, active-vs-retired filtering, supersede/obsolete callouts and the
  replacement back-link, chips + body sections + inline-markdown rendering,
  question open/resolved and linked-vs-plain resolution, tag counts that
  exclude retired, and the client-side filter scripts (resolved tab, search,
  retired toggle, ?area= URL param) executed in jsdom.
- Fixtures: add Q-003 (resolved, no slug, colon-space/special-char resolution
  as a viewer-render regression) and inline markdown in the active entry.

Caught and fixed a real bug: the homepage open-questions list rendered
q.data.id, which the questions schema strips, so the Q-ID showed blank; use
q.id like the questions page does.

Tests and fixtures stay out of the npm package (files whitelist; jsdom is a
devDependency) -- verified via npm pack --dry-run (22 files, unchanged).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
From the xhigh review of this branch:

- engines: raise node floor to "^22.18.0 || >=24.0.0". The old ">=22.12.0"
  admitted versions where the unit tests' native TS type stripping (needs
  >=22.18) and jsdom@^29 (needs ^22.13 || >=24, excludes 23.x) don't work.
- CI: run a matrix [22.18, 24] so the declared floor and current major are
  both exercised, instead of one lucky "22".
- tests: auto-discover via `node --test --test-concurrency=1` (rename
  fixture-check.mjs -> .test.mjs) so new test files aren't silently skipped,
  and serialize test files so render.test's build and cli.test's build can't
  race on the shared PACKAGE_ROOT Astro cache (the hazard the README warns of).
- render.test: assert build.status === 0 in the before() hook so a failed
  fixture build surfaces once, not as 8 opaque ENOENTs downstream.
- render.test: make the ?area= URL-param test discriminating -- give the
  active entry a second area (catalog) so the pre-set filter must actually
  exclude a row; previously every active entry was checkout, so the count
  assertions passed even if the filter were ignored.
- tests: extract shared scaffolding (BIN, FIXTURES, runBin, uniqueTemp) into
  tests/helpers.mjs instead of re-deriving it under three names across files.

All 30 tests pass; tarball unchanged (22 files; tests/helpers/jsdom excluded).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DustinVK DustinVK merged commit 51ded6f into main Jul 4, 2026
4 checks passed
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