Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
krotscheck opened this Issue Apr 12, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@krotscheck
Copy link

krotscheck commented Apr 12, 2019

馃悶 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
@alan-agius4

This comment has been minimized.

Copy link
Collaborator

alan-agius4 commented Apr 15, 2019

Hi krotscheck, thanks for reporting this.

There seems to be a bug where the host is not being respected. However, the exception is indeed correct as baseUrl should not be used in conjunction with the devserver.

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 15, 2019

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 15, 2019

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 15, 2019

@krotscheck

This comment has been minimized.

Copy link
Author

krotscheck commented Apr 15, 2019

Well, I was pointing that out more as a "Here's a workaround I tried" bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.