Skip to content

ng e2e's serve param does not working #10741

Closed
@pengx17

Description

@pengx17

Versions

Angular CLI: 6.0.0
Node: 8.9.1
OS: darwin x64
Angular: 6.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@angular/flex-layout              6.0.0-beta.15
@angular/material                 6.0.1
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

ng e2e --serve=false

Observed behavior

cli will serve the app on port 4200 as default and ignoring the serve param.

Desired behavior

should not serve the app when serve is false.

Mention any other details that might be useful (optional)

I suspect that the issue is caused by angular.json config after upgrade my app from 5.2 to 6.0. The e2e project section is shown below:

"my-app-e2e": {
      "root": "",
      "sourceRoot": "",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./e2e/protractor.conf.js",
            "devServerTarget": "my-app:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": ["e2e/tsconfig.json"],
            "exclude": ["**/node_modules/**"]
          }
        }
      }
    },

Since the e2e's architect has its option devServerTarget pointing to my-app:serve, it looks like e2e does not pick up the serve param and thus will use devServerTarget regardless.

The workaround I found is to add a new project section copying all content of the e2e project and remove devServerTarget option, then run ng e2e referencing the new project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions