Skip to content

feat: run web bundle tests in a real browser (#21) - #618

Merged
BelfordZ merged 3 commits into
masterfrom
fix/21-browser-testing
Oct 17, 2026
Merged

BelfordZ merged 3 commits into
masterfrom
fix/21-browser-testing

Conversation

@belfordzjeeves

Copy link
Copy Markdown
Contributor

Closes #21.

npm run test:web previously only proved the web bundle builds (webpack compile); nothing ever executed in a browser. Now it:

  • exposes the bundle as window.ReferenceResolver via webpack library output (webpack.config.js), and
  • runs scripts/test-web-browser.js: serves the bundle plus a test page from a local HTTP server, loads it in headless Chromium (Playwright), and asserts web-resolver behavior — internal refs, http urls, hash fragments on urls, file-protocol rejection (InvalidFileSystemPathError, since the web entry stubs file), bad pointers, and custom protocol handlers.

Two environment lessons baked in: the page and fixtures are served same-origin (Chromium's Private Network Access blocks opaque-origin fetches to loopback), and the browser launches with --no-proxy-server (ambient egress proxies flake localhost).

Verified: full npm test (lint + 19 jest unit tests + 6 browser tests) passes.

belfordzjeeves and others added 3 commits October 16, 2026 21:16
test:web previously only verified that the web bundle builds with
webpack; nothing ever executed in a browser. It now:

- exposes the bundle as window.ReferenceResolver (webpack library
  output), and
- runs scripts/test-web-browser.js, which serves the bundle plus a test
  page from a local server, loads it in headless Chromium via
  Playwright, and asserts the web resolver behavior: internal refs,
  http urls, hash fragments on urls, file-protocol rejection, bad
  pointers, and custom protocol handlers.

The page and fixtures are served same-origin so Chromium's Private
Network Access rules don't interfere, and the browser launches with
--no-proxy-server so ambient egress proxies can't flake localhost.
@BelfordZ
BelfordZ merged commit 2f453e3 into master Oct 17, 2026
3 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.

Add proper in-browser testing

2 participants