Skip to content

JS test safety net: unit-test infra for wwwroot fragments + lift the codecov wwwroot ignore #356

Closed

Description

@thomas-stegemann

2026-07-03 architecture audit, highest-risk finding: the frontend is ~72 000 LOC of vanilla JS (41 Core fragments = 60 286 LOC + ~12k LOC of plugin fragments) sharing one closure, and it is almost entirely untested and invisible to coverage:

  • codecov.yml ignores src/**/wwwroot/** — the whole frontend is excluded from coverage reporting.
  • 2 of 44 Core JS modules have direct tests (history-replay.test.mjs, script-sandbox.test.mjs, both written reactively after bugs). The v2.1 coverage-gap report (Test coverage gap report — v2.1 audit kickoff #312) counted 43/44 untested.
  • 3 Playwright specs exist, all workspace-lifecycle, against a manually started instance on :5180.
  • render-main.js alone is 10 144 LOC and holds the rail dispatch ladder — zero automated coverage.

This blocks #306/#311 (rail extraction cuts straight through render-main.js) and is the standing regression risk behind the morphdom-class bugs (#346, #349).

Proposal:

  • Adopt a JS unit-test runner for the node-testable pure modules (the two existing node --test files show the pattern works — scale it; vitest or stay with node --test, decide once)
  • Extract pure logic out of render-*.js into testable modules as extraction (Pluggable workbench: extract every remaining rail / module to packages + Bundle.Workbench (Phase G follow-up to #294) #306) proceeds — test-first per moved rail
  • Playwright: auto-spawn the tool (no manual :5180 prerequisite) + one spec per rail happy-path
  • Lift the wwwroot/** codecov ignore so JS coverage is at least visible (separate flag/component, no gate initially)
  • CI: run JS tests in the existing test job

Refs: #312 (gap report), #306/#311 (extraction this de-risks).

Activity

  1. thomas-stegemann commented on Jul 3, 2026

    @thomas-stegemann
    MemberAuthor

    First wave shipped (982a274):

    • JS tests now gate CI — a 'JS unit tests' step runs node --test over the 270 wwwroot-js assertions. They existed but never ran in the pipeline, which is exactly how benchmarks.test.mjs had silently rotted to a moved fragment path (benchmarks.js → the Benchmarking package) — fixed here.
    • npm scripts — test:js, test:js:coverage, test:e2e.
    • Harness proven to reach helpers.js — new list-filter-sort.test.mjs snips the pure applyListFilterSort / moveInArrayById bodies out of the big fragment and tests them; the test-first pattern Pluggable workbench: extract every remaining rail / module to packages + Bundle.Workbench (Phase G follow-up to #294) #306's rail extraction can follow.
    • Playwright auto-spawns the Tool (webServer) — npm run test:e2e works from a clean checkout; BOWIRE_BASE_URL still targets a dev instance.
    • codecov — documented why wwwroot stays ignored for the C# report + that JS coverage is tracked separately.

    Plus: CLI integration tests (8 xUnit tests driving the real BowireCli.RunAsync — help/dispatch, parse errors, bowire test exit codes, --fail-on never, --workspace, contract publish→verify), exercising option parsing + exit codes as a black box in-process.

    Remaining (own follow-ups): a dedicated javascript codecov flag (lcov upload — needs a per-flag ignore) and extracting more pure logic out of render-*.js as #306 proceeds. The CI gate + harness + first helpers coverage are the substance; closing the 'wire it up' core.

  2. thomas-stegemann commented on Jul 3, 2026

    @thomas-stegemann
    MemberAuthor

    Core delivered in 982a274 — the CI-gating blocker (the reason #306 rail extraction was risky) is lifted:

    Split out as follow-ups:

    Bonus landed alongside: CLI integration tests (8 xUnit tests driving the real BowireCli.RunAsync — dispatch, parse errors, exit codes, --fail-on, --workspace, contract round-trip).

  3. moved this from Backlog to Done in Bowireon Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions