Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request enables the previously disabled allowed-hosts.test.js test file and expands test coverage for host and origin header validation in webpack-dev-server. The changes reorganize existing tests and add new test cases covering various scenarios including IPv4, IPv6, and localhost connections, as well as origin header handling with IP addresses.
Changes:
- Enabled
allowed-hosts.test.jsby removing it from test ignore patterns in jest.config.js - Reorganized and renamed existing test cases to improve clarity
- Added new test cases for origin headers containing IP addresses and default host handling
- Updated API method calls from
checkHeadertoisValidHost
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| jest.config.js | Removed test ignore pattern to enable allowed-hosts.test.js |
| tests/e2e/allowed-hosts.test.js | Reorganized test structure, added new test cases for various host/origin scenarios, updated API method calls |
| tests/e2e/snapshots/allowed-hosts.test.js.snap.webpack5 | Added snapshot expectations for new test cases and updated existing snapshots with improved error formatting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request updates and expands the snapshot tests for allowed hosts and host header handling in the webpack-dev-server test suite. The changes include new test cases for different host and origin scenarios, improved output for error responses, and more detailed console and error message tracking for various websocket connection types.
The most important changes are:
Expanded test coverage for allowed hosts:
options.allowedHostsis set toauto, covering cases where the host is specified directly or viaclient.webSocketURL, and for various host values such as[::1],0.0.0.0,127.0.0.1, andlocalhost, across both"sockjs"and"ws"websocket transports. [1] [2]New origin header handling tests:
"auto"allowed hosts setting, for both"sockjs"and"ws"transports.Improved error response and console output validation:
<meta name="color-scheme" content="light dark">tag and improved formatting, and updated the expected console messages for forbidden (403) responses.Default host handling tests:
"localhost"are allowed by default for both"sockjs"and"ws"transports, with corresponding console and error message expectations.Detailed reconnection and error flow tests: