-
Notifications
You must be signed in to change notification settings - Fork 30
fix: support HTTPS servers and handle named pipe ports #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,8 +103,20 @@ export class DevtoolsPlugin { | |
| } | ||
|
|
||
| onStart({ port }: IPluginStartEvent) { | ||
| const numericPort = this.options.customPort ?? ( | ||
| typeof port === 'string' ? parseInt(port, 10) + 1 : port + 1); | ||
| let numericPort: number; | ||
| if (this.options.customPort) { | ||
| numericPort = this.options.customPort; | ||
| } else if (typeof port === 'number') { | ||
| numericPort = port + 1; | ||
| } else { | ||
|
Comment on lines
+106
to
+111
|
||
| const parsed = parseInt(port, 10); | ||
| if (isNaN(parsed)) { | ||
| numericPort = 3979; | ||
| this.log.warn(`Port is a named pipe (${port}), using default devtools port ${numericPort}. Set customPort to override.`); | ||
| } else { | ||
| numericPort = parsed + 1; | ||
| } | ||
|
Comment on lines
+112
to
+118
|
||
| } | ||
|
|
||
| this.express.use( | ||
| router({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion is tightly coupled to a specific error message string, making the test brittle to future wording changes. A more robust assertion would directly verify the adapter is using the passed-in server instance (e.g., by checking internal state via a safe test-only accessor, or by asserting behavior that cannot depend on the exact wording, such as checking the error type/shape if available).