Skip to content

jawstree: run production regression pages under jsdom#151

Merged
linkdata merged 1 commit into
mainfrom
test/jawstree-jsdom
Jul 19, 2026
Merged

jawstree: run production regression pages under jsdom#151
linkdata merged 1 commit into
mainfrom
test/jawstree-jsdom

Conversation

@linkdata

Copy link
Copy Markdown
Owner

Why

The two jawstree production regression tests launch headless Firefox to render a page and screenshot it. On macOS this intermittently aborts at Firefox startup — _RegisterApplication(), unable to get application ASN from launchservicesd (SIGABRT in TransformProcessType) — which fails the test run and pops a "Firefox has quit unexpectedly" crash dialog. The failure is environmental (GUI-session registration can be refused for processes launched from sandboxed/unattended contexts), so no browser-based harness avoids it.

What

  • New jawstree/jsdom_test.go harness: loads a generated page under jsdom via node -e (runScripts: "dangerously", resources: "usable", pretendToBeVisual for the widget's requestAnimationFrame use) and passes only when the page turns its #result element green. On failure it reports the element state and any jsdom errors instead of an opaque red pixel.
  • Both regression tests keep their pages and assertions byte-for-byte, only the loader changes; the screenshot/PNG-pixel readout is gone. No GUI process is launched, so the launchservicesd failure mode cannot occur on any platform.
  • jsdom resolves from an ancestor node_modules (e.g. npm install jsdom at the repo root) or from the npm global root via NODE_PATH. Tests skip when node or jsdom is unavailable and fail instead when JAWS_REQUIRE_NODE is set, matching the existing node-driven test convention.
  • GitHub runner images ship node/npm but no npm packages, so the build workflow installs jsdom (npm install --no-save jsdom) before the test step; .gitignore covers local npm artifacts. The 386 leg intentionally skips these tests (no jsdom there).

Verification

  • Without jsdom: both tests skip; with JAWS_REQUIRE_NODE=1 they fail loudly.
  • With jsdom: both pass, including under -race; a deliberately never-green page makes the runner exit non-zero with diagnostics.
  • Full local gate: go vet, gofmt -l, staticcheck, golangci-lint, gosec, go build, go test -race ./... all clean.

Load the dynamic-insert and reconcile regression pages with node and the
jsdom package instead of a headless browser, reading the page's #result
element directly rather than decoding a screenshot pixel. Launching a
real browser is a GUI app launch: on macOS it intermittently aborts at
startup when launchservicesd refuses to issue an ASN ("unable to get
application ASN from launchservicesd"), failing the run and popping a
"Firefox has quit unexpectedly" crash dialog. jsdom runs the same
shipped assets without any GUI process, so that failure mode cannot
occur, and it reports which condition failed instead of a red pixel.

The tests skip when node or jsdom is unavailable, and fail instead when
JAWS_REQUIRE_NODE is set. GitHub runner images ship node and npm but no
npm packages, so the build workflow installs jsdom before testing.
@linkdata
linkdata merged commit 9864d79 into main Jul 19, 2026
7 checks passed
@linkdata
linkdata deleted the test/jawstree-jsdom branch July 19, 2026 12:42
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