Skip to content

Add framework test suite: 144 tests across all core modules + CI#7

Open
douglasjordan2 wants to merge 15 commits into
mainfrom
feature/test-suite
Open

Add framework test suite: 144 tests across all core modules + CI#7
douglasjordan2 wants to merge 15 commits into
mainfrom
feature/test-suite

Conversation

@douglasjordan2

Copy link
Copy Markdown
Owner

Adds a bun:test suite for the entire hzml/ core (~1,600 lines), built task-by-task from a reviewed spec (Sonnet 5 review → Opus 4.8 meta-review → final verification pass). Zero new dependencies.

Coverage — 144 tests / 257 assertions across 19 files, ~160ms

Pure units

  • match.test.ts — route table building, last-segment precedence (static file > dynamic file > static dir index > dynamic dir index), multi-segment params, outermost-first layout accumulation
  • render.test.ts — multi-root flattening (Multi-root templates join nested arrays with commas (missing flatten in html() wrappers) #5 regression), attribute/child escaping, SafeHtml passthrough, boolean attrs, void tags, depth-1 vs flat(Infinity) component-children asymmetry
  • state.test.ts — query cache hit/miss/invalidation, toggle registry semantics, deferred registry
  • deferred.test.tsSymbol.for branding
  • htmz.test.tsmergeHead singleton-wins rules, tag marking, htmzHead/htmzTail shell
  • plugin.test.ts — sequential setup, setDb propagation, extend/inject override
  • dev.test.ts — SSE manager fan-out and dead-client cleanup, error overlay escaping

Router integration

  • router.parse.test.ts — block extraction; notes route-level <loader> is inert (component-only)
  • router.template.test.ts — template compilation, helper-shadowing protection, ctx-path regression for Multi-root templates join nested arrays with commas (missing flatten in html() wrappers) #5's second call site
  • router.components.test.ts — component loading, classcls, loader string/object/db behaviors, cache lifecycle
  • router.script.test.ts — GET/POST selection, params/body, all six import transform forms via file:// fixtures, route-context caching

HTTP handler (no ports — the handler is called as a plain function; fixtures live in mkdtemp sandboxes)

  • static serving + MIME, full-page document shape, layout wrapping, head merging with per-route <head>, partials, redirects (302 + meta-refresh), deferred streaming (swap templates + ndjson endpoint), toggle inputs/CSS, fill→slot channels, .toggle-manifest containment, error overlays

Infra

  • db.test.ts (:memory: SQLite), "test": "bun test hzml" script, GitHub Actions workflow running the suite on PRs and pushes to main

Notes

  • No framework bugs found; two review-era open questions resolved empirically (Bun's Response.redirect accepts relative URLs; dynamic import() in compiled route scripts resolves relative to router.ts's directory)
  • Deliberately out of scope: browser E2E of the client htmz script, tree-sitter corpus tests, and a typecheck CI gate (blocked on 45 pre-existing tsc --noEmit errors)

🤖 Generated with Claude Code

douglasjordan2 and others added 15 commits July 11, 2026 11:53
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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