diff --git a/modules/testing/builder/projects/hello-world-app/angular.json b/modules/testing/builder/projects/hello-world-app/angular.json index 536fe863f6da..95607701be8f 100644 --- a/modules/testing/builder/projects/hello-world-app/angular.json +++ b/modules/testing/builder/projects/hello-world-app/angular.json @@ -103,8 +103,7 @@ "builder": "@angular-devkit/build-angular:dev-server", "options": { "buildTarget": "app:build", - "watch": false, - "host": "127.0.0.1" + "watch": false }, "configurations": { "production": { diff --git a/packages/angular/build/BUILD.bazel b/packages/angular/build/BUILD.bazel index d8f89be1d5cd..2f74117ff850 100644 --- a/packages/angular/build/BUILD.bazel +++ b/packages/angular/build/BUILD.bazel @@ -292,6 +292,10 @@ jasmine_test( name = "dev-server_integration_tests", size = "medium", data = [":dev-server_integration_test_lib"], + env = { + # Force IPv4 to resolve RBE resolution issues + "NODE_OPTIONS": "--dns-result-order=ipv4first", + }, flaky = True, shard_count = 10, ) diff --git a/packages/angular/build/src/builders/dev-server/tests/setup.ts b/packages/angular/build/src/builders/dev-server/tests/setup.ts index 0385e6834fd1..2c5906e9644d 100644 --- a/packages/angular/build/src/builders/dev-server/tests/setup.ts +++ b/packages/angular/build/src/builders/dev-server/tests/setup.ts @@ -62,10 +62,6 @@ export const BASE_OPTIONS = Object.freeze({ buildTarget: 'test:build', port: 0, - // Force an IPv4 address as with RBE there are currently resolution issues with IPv6 addresses. - // http://localhost is resolved to IPv6 address with vite and webpack but to IPv4 with node fetch. - host: '127.0.0.1', - // Watch is not supported for testing in vite as currently there is no teardown logic to stop the watchers. watch: false, }); diff --git a/packages/angular_devkit/build_angular/BUILD.bazel b/packages/angular_devkit/build_angular/BUILD.bazel index 2a505e1fd8ca..9d145d03682c 100644 --- a/packages/angular_devkit/build_angular/BUILD.bazel +++ b/packages/angular_devkit/build_angular/BUILD.bazel @@ -422,6 +422,9 @@ LARGE_SPECS = { "//modules/testing/builder:node_modules/@angular-devkit/build-angular", ], env = { + # Force IPv4 to resolve RBE resolution issues + "NODE_OPTIONS": "--dns-result-order=ipv4first", + # TODO: Replace Puppeteer downloaded browsers with Bazel-managed browsers, # or standardize to avoid complex configuration like this! "PUPPETEER_DOWNLOAD_PATH": "../../../node_modules/puppeteer/downloads", diff --git a/packages/angular_devkit/build_angular/src/builders/dev-server/specs/ssl_spec.ts b/packages/angular_devkit/build_angular/src/builders/dev-server/specs/ssl_spec.ts index 51dba9d0a4d8..60ed65793c7f 100644 --- a/packages/angular_devkit/build_angular/src/builders/dev-server/specs/ssl_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/dev-server/specs/ssl_spec.ts @@ -33,7 +33,7 @@ describe('Dev Server Builder ssl', () => { runs.push(run); const output = (await run.result) as DevServerBuilderOutput; expect(output.success).toBe(true); - expect(output.baseUrl).toMatch(/^https:\/\/127\.0\.0\.1:\d+\//); + expect(output.baseUrl).toMatch(/^https:\/\/localhost:\d+\//); const response = await fetch(output.baseUrl, { dispatcher: new Agent({ @@ -112,7 +112,7 @@ describe('Dev Server Builder ssl', () => { runs.push(run); const output = (await run.result) as DevServerBuilderOutput; expect(output.success).toBe(true); - expect(output.baseUrl).toMatch(/^https:\/\/127\.0\.0\.1:\d+\//); + expect(output.baseUrl).toMatch(/^https:\/\/localhost:\d+\//); const response = await fetch(output.baseUrl, { dispatcher: new Agent({ diff --git a/packages/angular_devkit/build_angular/src/builders/dev-server/tests/setup.ts b/packages/angular_devkit/build_angular/src/builders/dev-server/tests/setup.ts index 7b8d3851544e..f92d3b713c9f 100644 --- a/packages/angular_devkit/build_angular/src/builders/dev-server/tests/setup.ts +++ b/packages/angular_devkit/build_angular/src/builders/dev-server/tests/setup.ts @@ -63,10 +63,6 @@ export const BASE_OPTIONS = Object.freeze({ buildTarget: 'test:build', port: 0, - // Force an IPv4 address as with RBE there are currently resolution issues with IPv6 addresses. - // http://localhost is resolved to IPv6 address with vite and webpack but to IPv4 with node fetch. - host: '127.0.0.1', - // Watch is not supported for testing in vite as currently there is no teardown logic to stop the watchers. watch: false, }); diff --git a/packages/angular_devkit/build_webpack/BUILD.bazel b/packages/angular_devkit/build_webpack/BUILD.bazel index f66ea94f1919..3a104c243a66 100644 --- a/packages/angular_devkit/build_webpack/BUILD.bazel +++ b/packages/angular_devkit/build_webpack/BUILD.bazel @@ -90,6 +90,10 @@ jasmine_test( "//:node_modules/typescript", "//:node_modules/zone.js", ], + env = { + # Force IPv4 to resolve RBE resolution issues + "NODE_OPTIONS": "--dns-result-order=ipv4first", + }, ) genrule( diff --git a/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.cjs b/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.cjs index 63a5a947e7ea..b1f988ab2071 100644 --- a/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.cjs +++ b/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.cjs @@ -3,11 +3,6 @@ const path = require('path'); module.exports = { mode: 'development', entry: path.resolve(__dirname, './src/main.js'), - devServer: { - // Force an IPv4 address as with RBE there are currently resolution issues with IPv6 addresses. - // http://localhost is resolved to IPv6 address with vite and webpack but to IPv4 with node fetch. - host: '127.0.0.1', - }, module: { rules: [ // rxjs 6 requires directory imports which are not support in ES modules. diff --git a/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.mjs b/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.mjs index cd76b55970d3..289fff7bdb69 100644 --- a/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.mjs +++ b/packages/angular_devkit/build_webpack/test/basic-app/webpack.config.mjs @@ -4,11 +4,6 @@ import { fileURLToPath } from 'url'; export default { mode: 'development', entry: resolve(fileURLToPath(import.meta.url), '../src/main.js'), - devServer: { - // Force an IPv4 address as with RBE there are currently resolution issues with IPv6 addresses. - // http://localhost is resolved to IPv6 address with vite and webpack but to IPv4 with node fetch. - host: '127.0.0.1', - }, module: { rules: [ // rxjs 6 requires directory imports which are not support in ES modules.