Angular-cli: Passing custom arguments to e2e

Created on 13 Jun 2018  路  3Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x ] devkit
- [ ] schematics

Versions

angular 6
node v8.9.4
npm v6.1.0
Windows 10.

Repro steps

After upgrading project to Angular 6 an e2e testing stopped to passing additional command line arguments.
Command:
ng e2e my-project arg1 arg2 arg3

The log given by the failure

NodeJS.Process.agrv[] array includes only 2 default arguments without arg1 arg2 arg3

Desired functionality

Argument should be passed as it was with Angular 5.

devkibuild-angular feature

Most helpful comment

@jgf5013 most likely not. What you can do now is use npm to run e2e command and pass argument to it.
npm run e2e --my-param=test -- --suite=someSuite // args after -- are append to the command listed in package.json
Then you can access value of my-param via process.env.npm_config_my-param (or something similar on process.env)

All 3 comments

Inability to pass additional args through is affecting our upgrade from 5.2 to 6. Any timeline for when this will be fixed ?

For context we pass a "shards" arg to ng test, which is used in karma.conf to configure the karma-parallel plugin. Unable to do that now and given how slow angular unit tests are, this is a deal breaker.

Would really like to be able to do something like the following:
ng e2e <e2e-project-name> --capabilities.chromeOptions.binary="custom/path/chrome/binary"

Is this possible?

@jgf5013 most likely not. What you can do now is use npm to run e2e command and pass argument to it.
npm run e2e --my-param=test -- --suite=someSuite // args after -- are append to the command listed in package.json
Then you can access value of my-param via process.env.npm_config_my-param (or something similar on process.env)

Was this page helpful?
0 / 5 - 0 ratings