Repository navigation
feat: run web bundle tests in a real browser (#21) - #618
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #21.
npm run test:webpreviously only proved the web bundle builds (webpack compile); nothing ever executed in a browser. Now it:window.ReferenceResolvervia webpacklibraryoutput (webpack.config.js), andscripts/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 stubsfile), 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.