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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Allow frameworks to specify extra command line flags #3994

Merged
merged 1 commit into from Jan 23, 2017

Conversation

Projects
None yet
6 participants
@heathkit
Member

heathkit commented Jan 21, 2017

Fix for #3978.

Our initial plan to allow setting --disableChecks with an environment variable is insufficient, since the custom framework isn't even require()'d until after the config is parsed. This moves the unknown flag check into the runner, and gives frameworks a way to specify extra flags they accept.

@googlebot googlebot added the cla: yes label Jan 21, 2017

Show outdated Hide outdated lib/runner.ts Outdated
runTestPreparer(extraFlags?: string[]): q.Promise<any> {
let unknownFlags = this.config_.unknownFlags_ || [];
if (extraFlags) {
unknownFlags = unknownFlags.filter((f) => extraFlags.indexOf(f) === -1);

This comment has been minimized.

@cnishina

cnishina Jan 21, 2017

Member

Yup I stand corrected. This should be ===. Filter flags that do not exist in extra flags. LGTM.

@cnishina

cnishina Jan 21, 2017

Member

Yup I stand corrected. This should be ===. Filter flags that do not exist in extra flags. LGTM.

@cnishina cnishina added the pr: LGTM label Jan 21, 2017

@sjelin

sjelin approved these changes Jan 23, 2017

Update the commit message to link to issue

@heathkit heathkit merged commit 5856037 into angular:master Jan 23, 2017

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@heathkit heathkit deleted the heathkit:disable-checks branch Jan 23, 2017

@segrey

This comment has been minimized.

Show comment
Hide comment
@segrey

segrey Jan 27, 2017

Hi guys!
Unfortunately, it won't help IntelliJ protractor integration which passes --intellijOriginalConfigFile=/path/to/protractor.conf. Even it already passes --disableChecks option, previously released version don't have it. What do you think about disabling checking for unknown flags in 5.1 completely, and restore this functionality in the next version? That would give us time to release IDE version with --disableChecks option. Thanks in advance!

segrey commented Jan 27, 2017

Hi guys!
Unfortunately, it won't help IntelliJ protractor integration which passes --intellijOriginalConfigFile=/path/to/protractor.conf. Even it already passes --disableChecks option, previously released version don't have it. What do you think about disabling checking for unknown flags in 5.1 completely, and restore this functionality in the next version? That would give us time to release IDE version with --disableChecks option. Thanks in advance!

@heathkit

This comment has been minimized.

Show comment
Hide comment
@heathkit

heathkit Jan 27, 2017

Member

Unknown flags will log a warning message in 5.1 instead of quitting with an error. We're hoping to get 5.1 out this Monday.

Member

heathkit commented Jan 27, 2017

Unknown flags will log a warning message in 5.1 instead of quitting with an error. We're hoping to get 5.1 out this Monday.

@segrey

This comment has been minimized.

Show comment
Hide comment
@segrey

segrey Jan 27, 2017

Thanks for the prompt turnaround! Warning is a good response to unknown flags.

segrey commented Jan 27, 2017

Thanks for the prompt turnaround! Warning is a good response to unknown flags.

jan-molak added a commit to jan-molak/serenity-js that referenced this pull request Feb 11, 2017

feat(serenity-protractor): Support for Protractor 5.1.x
This change adds support for using Serenity/JS with Protractor 5.0.0, 5.1.0 and 5.1.1:
- `ProtractorNotifier` deals with Protractor 5.1.0 requirement for test frameworks to invoke `runner.afterEach` after every test,
so that the browser is correctly restarted between the tests. See angular/protractor#4087
- `TestFrameworkDetector` registers `mochaOpts` and `cucumberOpts` as valid command line options,
benefiting from angular/protractor#3994 and dealing with a bug introduced in Protractor 5.0.0, which prevents command line arguments
from being passed on to custom test frameworks. See angular/protractor#3978
- Updated the examples and documentation to work with Protractor 5.1.x
- Enables #18

Related issues: angular/protractor#3978 angular/protractor#3994 angular/protractor#4087 #18

igniteram added a commit to igniteram/protractor that referenced this pull request Feb 21, 2017

fix(cli): Allow frameworks to specify flags they recognize. (angular#…
…3994)

Fix for angular#3978.

Our initial plan to allow setting --disableChecks with an environment variable is insufficient, since the custom framework isn't even require()'d until after the config is parsed. This moves the unknown flag check into the runner, and gives frameworks a way to specify extra flags they accept.
@anatoliyarkhipov

This comment has been minimized.

Show comment
Hide comment
@anatoliyarkhipov

anatoliyarkhipov Sep 28, 2017

Can you please provide an example of using the unknownFlags_ option? We use protractor 5.1.2 and in the config file I tried to define custom flags:

  unknownFlags_: [
    'logX',
    '--logX',
  ],

But I still receive the warning:

$ npm run spec -- --logX

> protractor ./specs/conf.js "--logX"

[13:47:28] W/runner - Ignoring unknown extra flags: logX. This will be an error in future versions, please use
 --disableChecks flag to disable the  Protractor CLI flag checks.

Did I miss something? 🤔

anatoliyarkhipov commented Sep 28, 2017

Can you please provide an example of using the unknownFlags_ option? We use protractor 5.1.2 and in the config file I tried to define custom flags:

  unknownFlags_: [
    'logX',
    '--logX',
  ],

But I still receive the warning:

$ npm run spec -- --logX

> protractor ./specs/conf.js "--logX"

[13:47:28] W/runner - Ignoring unknown extra flags: logX. This will be an error in future versions, please use
 --disableChecks flag to disable the  Protractor CLI flag checks.

Did I miss something? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment