Skip to content

ng e2e does not respect host setting in angular.json #14151

Closed
@krotscheck

Description

@krotscheck

🐞 Bug report

Command (mark with an x)

- [ x ] serve
- [ x ] e2e

Is this a regression?

I don't know.

Description

When executing ng e2e, the host parameter in the serve block is ignored.

🔬 Minimal Reproduction

$ ng init yourapp
$ nano angular.json  # add "host": "localhost.local" to serve configuration 
$ sudo sh -c 'echo "127.0.0.1   localhost.local" >> /etc/hosts'
$ ng serve
** Angular Live Development Server is listening on localhost.local:4200, ...

$ ng e2e
** Angular Live Development Server is listening on localhost:4200, ...

angular.json serve block should be:

        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "yourapp:build",
            "host": "localhost.local"
          },
          "configurations": {
            "production": {
              "browserTarget": "yourapp:build:production"
            }
          }
        },

Note that passing baseUrl throws an exception.

ng e2e --baseUrl="http://localhost.local:4200"
The 'baseUrl' option cannot be used with 'devServerTarget'.
When present, 'devServerTarget' will be used to automatically setup 'baseUrl' for Protractor.

🌍 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 7.3.8
Node: 8.11.1
OS: darwin x64
Angular: 7.2.12
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.8
@angular-devkit/build-angular     0.13.8
@angular-devkit/build-optimizer   0.13.8
@angular-devkit/build-webpack     0.13.8
@angular-devkit/core              7.3.8
@angular-devkit/schematics        7.3.8
@angular/cli                      7.3.8
@ngtools/webpack                  7.3.8
@schematics/angular               7.3.8
@schematics/update                0.13.8
rxjs                              6.3.3
typescript                        3.2.4
webpack                           4.29.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions