Repository navigation
fix(@angular/build): disable strictPort when port 0 is used in dev-server - #34055
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces dynamic configuration for the strictPort option in the Angular dev-server, allowing it to be disabled when a random port (0) is requested. It also enhances test reliability in serve-live-reload-proxies_spec.ts by replacing hardcoded timeouts with a polling-based waitForAppLiveReload helper and ignoring proxy connection errors during reloads. The reviewer suggests a valuable improvement to use the resolved port variable instead of options.port when determining strictPort to avoid inconsistencies with environment overrides.
…rver When port 0 is specified, an ephemeral port is selected. Previously, strictPort was hardcoded to true, which caused Vite to fail immediately if the ephemeral port was occupied during rebuilds or rapid restarts. strictPort is now set to false when port 0 is requested, allowing Vite to fall back to an available port.
… proxies dev-server test Ignore proxy connection errors when the browser reloads or disconnects, and replace fixed setTimeout delays with waitForAppLiveReload polling helper to avoid navigation race conditions.
c61b090 to
843adb6
Compare
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR addresses flaky test failures identified in the dev-server test suites:
@angular/builddev-server port collision:port: 0is configured, an ephemeral port is requested. PreviouslystrictPort: truewas hardcoded in the Vite configuration, which caused dev-server restarts or rebuild error detection runs to fail if the ephemeral port was occupied before Vite bound to it.strictPort: port !== 0(falling back to an open port whenport: 0is specified).@angular-devkit/build-angularlive-reload proxy test flakiness:serve-live-reload-proxies_spec.ts, the proxy HTTP server lacked an error handler, causing unhandledECONNRESETerrors when the headless browser disconnected or reloaded.500mstimeouts with awaitForAppLiveReloadpolling helper that tolerates execution context destructions during live-reload navigation.