Repository navigation
test(e2e): let TEST_HOST choose the test server's interface - #132
Merged
Merged
Conversation
test-server.js always listened on every interface, so the example pages were reachable from the local network during e2e and verification runs. TEST_HOST (for example 127.0.0.1) picks the interface; unset keeps the old behavior. verify-nojs-elements now launches with TEST_HOST=127.0.0.1.
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.
Summary
test-server.jsalways listened on every interface, so the example pages were reachable from the local network during e2e and verification runs (finding from theverify-nojs-elementsskill, #131).TEST_HOSTpicks the interface, for exampleTEST_HOST=127.0.0.1for loopback only. It pairs with the existingTEST_PORT. Unset, the server listens on all interfaces exactly as before, sonpmscripts, the PlaywrightwebServerand CI are unchanged.NoJS-Elements Test Server — http://localhost:<port> (bound to <address>).verify-nojs-elementslaunches withTEST_HOST=127.0.0.1; its Isolation note is updated.CHANGELOG.mdUnreleased entry. No version bump.Evidence (fail before, pass after)
__tests__/test-server.test.js(Jest, node environment) starts the realtest-server.json a free port and requests/package.jsonover IPv4 and, where the machine has an IPv6 loopback, over::1.::1answered200, expectedECONNREFUSEDverify-nojs-elementslaunch on 4321127.0.0.1:4321;curlvia127.0.0.1200, via[::1]refused;modalanddndjourneys passversion:checkOKBlast radius
TEST_HOSTunset,server.listen(PORT, undefined, cb)binds exactly whatserver.listen(PORT, cb)bound. The second test runs the unset case and still reaches the server over both127.0.0.1and::1.e2e/playwright.config.tsis untouched. The whole Chromium e2e suite passes with the default (234 passed). WithTEST_HOST=127.0.0.1, themodalanddndspecs also pass (25 passed):baseURLhttp://localhost:<port>still reaches the server, because Chromium falls back from::1to127.0.0.1.TEST_HOST.docs/dev-server.js(npm start) is a separate server and keeps its 3000-3010 port scan.