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

Already on GitHub? Sign in to your account

v6 CLI arg verification breaks extra args parsing #3625

Open
longlho opened this issue Jan 19, 2021 · 7 comments · Fixed by tetsunosuke/test-skyway#56 or karronoli/redpen#10 · May be fixed by chauncey-garrett/material2#205, wagnermaciel/components#36 or PDSSnyk/juice-shop#68
Labels

Comments

@longlho
Copy link
Contributor

longlho commented Jan 19, 2021

Hello, currently karma CLI doesn't allow explicit test files as arg so we're passing them at the end and parse them out in karma.conf.js and v6 breaks it so I'm essentially asking if:

  1. Karma CLI can support explicit test files passed in as args OR
  2. Make strict mode be optional

I understand that this is not previously a feature but a lot of stack overflow answers seem to point to this mechanism being the workaround to further modify karma conf using CLI arg.

The way we're calling it is essentially karma start karma.conf.js [testFiles...]

Thanks!

@johnjbarton
Copy link
Contributor

We hit the same issue.

I wonder if we can use -- testFiles and change our karma.conf.js to look in process.argv._?
https://github.com/yargs/yargs/blob/HEAD/docs/tricks.md#stop-parsing

@devoto13
Copy link
Collaborator

@johnjbarton Good idea! We can both retain strict validation of Karma options and allow users to pass arbitrary custom options. The only concern is that we already use this feature for clientArgs in karma run command, so they will conflict. Need to think a bit about how we're going to handle it.

@jginsburgn jginsburgn pinned this issue Jan 20, 2021
@jginsburgn jginsburgn unpinned this issue Jan 20, 2021
@devoto13
Copy link
Collaborator

devoto13 commented Jan 24, 2021

So I think the best solution would be to introduce --client-args flag for karma run command, then add a warning that the behavior of karma run -- my-arg form is going to change and point to the new --client-args flag. Allow passing arbitrary arguments after -- on any karma command. If this sounds like a good plan, I'll work on the PR in the coming days.

@paulie4
Copy link

paulie4 commented Jan 28, 2021

This also broke the main feature of karma-jasmine-spec-tags, see their Issue 12.

@devoto13
Copy link
Collaborator

@paulie4 Thanks for sharing!

Looking at this library I start to think that maybe we should provide an API for a plugin to register their CLI arguments. This way there will be one standard mechanism and as a bonus, we can include parameters provided by plugins in the karma --help output. Which will be a neat feature.

The solution from #3625 (comment) will not work for karma-jasmine-spec-tags without extra changes on their side. At this point, I lean towards temporarily reverting the strict parameters validation and gathering more feedback on the custom parameter use cases. So we can design a mechanism, which works for everybody.

@longlho
Copy link
Contributor Author

longlho commented Jan 29, 2021

Agree. Seems like a big change w/o some sort of RFC.

devoto13 added a commit to devoto13/karma that referenced this issue Jan 31, 2021
As discussed in karma-runner#3625 there are multiple use cases, where Karma users rely on the possibility to pass arbitrary options/arguments to the karma CLI. These arguments then are either handled in a `karma.conf.js` file or are consumed by Karma plugins. Given the disruptive effect of the strict parameters validation and the lack of the feasible workarounds, the change is reverted until we have better understanding of the custom options/arguments use cases and can implement a solution which works for everybody.
devoto13 added a commit to devoto13/karma that referenced this issue Jan 31, 2021
As discussed in karma-runner#3625 there are multiple cases, where Karma users rely on the possibility to pass arbitrary options/arguments to the karma CLI. These arguments then are either handled in a `karma.conf.js` file or are consumed by Karma plugins. Given the disruptive effect of the strict parameters validation and the lack of the feasible workarounds, the change is reverted until we have better understanding of the custom options/arguments use cases and can implement a solution which works for everybody.
devoto13 added a commit to devoto13/karma that referenced this issue Jan 31, 2021
As discussed in karma-runner#3625 there are multiple cases, where Karma users rely on the possibility to pass arbitrary options/arguments to the karma CLI. These arguments are either handled in a `karma.conf.js` file or are consumed by Karma plugins. Given the disruptive effect of the strict parameters validation and the lack of the feasible workarounds, the feature is reverted until we have better understanding of the custom options/arguments use cases and can implement a solution which works for everybody.
@matz3
Copy link
Contributor

matz3 commented Feb 1, 2021

karma-ui5 is another plugin which made use of the feature to pass CLI args to override config options (e.g. --ui5.url, see https://github.com/SAP/karma-ui5#url).

johnjbarton pushed a commit that referenced this issue Feb 1, 2021
As discussed in #3625 there are multiple cases, where Karma users rely on the possibility to pass arbitrary options/arguments to the karma CLI. These arguments are either handled in a `karma.conf.js` file or are consumed by Karma plugins. Given the disruptive effect of the strict parameters validation and the lack of the feasible workarounds, the feature is reverted until we have better understanding of the custom options/arguments use cases and can implement a solution which works for everybody.
karmarunnerbot pushed a commit that referenced this issue Feb 1, 2021
## [6.0.4](v6.0.3...v6.0.4) (2021-02-01)

### Bug Fixes

* **cli:** temporarily disable strict parameters validation ([#3641](#3641)) ([9c755e0](9c755e0)), closes [#3625](#3625)
* **client:** fix a false positive page reload error in Safari ([#3643](#3643)) ([2a57b23](2a57b23))
* ensure that Karma supports running tests on IE 11 ([#3642](#3642)) ([dbd1943](dbd1943))
This was referenced Mar 14, 2021
anthony-redFox pushed a commit to anthony-redFox/karma that referenced this issue May 16, 2023
…ner#3641)

As discussed in karma-runner#3625 there are multiple cases, where Karma users rely on the possibility to pass arbitrary options/arguments to the karma CLI. These arguments are either handled in a `karma.conf.js` file or are consumed by Karma plugins. Given the disruptive effect of the strict parameters validation and the lack of the feasible workarounds, the feature is reverted until we have better understanding of the custom options/arguments use cases and can implement a solution which works for everybody.
anthony-redFox pushed a commit to anthony-redFox/karma that referenced this issue May 16, 2023
## [6.0.4](karma-runner/karma@v6.0.3...v6.0.4) (2021-02-01)

### Bug Fixes

* **cli:** temporarily disable strict parameters validation ([karma-runner#3641](karma-runner#3641)) ([9c755e0](karma-runner@9c755e0)), closes [karma-runner#3625](karma-runner#3625)
* **client:** fix a false positive page reload error in Safari ([karma-runner#3643](karma-runner#3643)) ([2a57b23](karma-runner@2a57b23))
* ensure that Karma supports running tests on IE 11 ([karma-runner#3642](karma-runner#3642)) ([dbd1943](karma-runner@dbd1943))
@PDSSnyk PDSSnyk linked a pull request May 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment