-
Notifications
You must be signed in to change notification settings - Fork 795
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
bug: cli args parsing fails #3481
Comments
hey @jasperbosch, thanks for filing this issue and for doing some code spelunking! You're right that this is an issue. I was just in this code recently so I'll fix it today. |
This fixes a bug with how these flags were being parsed which was messing with Jest. Basically, the issue related to how the `knownArgs` array on the `ConfigFlags` object was being populated. For CLI key-value args of the format `--argName=value` the whole string `"--argName=value"` was being added _as well as_ the value string `"value"`, which had the effect of passing duplicate args to Jest. This refactors how such arguments are handled to always parse apart the argument name and the value, adding only the argument name and then the argument value, so that if you pass, for instance, `--outputFile=output.json`, the args passed to Jest will look like ```ts ['--outputFile', 'output.json'] ``` See #3471 and #3481 for more details
This fixes a bug with how these flags were being parsed which was messing with Jest. Basically, the issue related to how the `knownArgs` array on the `ConfigFlags` object was being populated. For CLI key-value args of the format `--argName=value` the whole string `"--argName=value"` was being added _as well as_ the value string `"value"`, which had the effect of passing duplicate args to Jest. This refactors how such arguments are handled to always parse apart the argument name and the value, adding only the argument name and then the argument value, so that if you pass, for instance, `--outputFile=output.json`, the args passed to Jest will look like ```ts ['--outputFile', 'output.json'] ``` See #3471 and #3481 for more details
This fixes a bug with how these flags were being parsed which was messing with Jest. Basically, the issue related to how the `knownArgs` array on the `ConfigFlags` object was being populated. For CLI key-value args of the format `--argName=value` the whole string `"--argName=value"` was being added _as well as_ the value string `"value"`, which had the effect of passing duplicate args to Jest. This refactors how such arguments are handled to always parse apart the argument name and the value, adding only the argument name and then the argument value, so that if you pass, for instance, `--outputFile=output.json`, the args passed to Jest will look like ```ts ['--outputFile', 'output.json'] ``` See #3471 and #3481 for more details
Thanks for reporting this! Just to update you, there's a bugfix PR up here: #3483 which just merged into If you want to test it out to make sure it fixes your issue you could
If you'd rather wait for a pre-release or release build to try that out no worries :) |
The fix for this issue has been officially released as a part of Stencil v2.17.2. As a result, I'm going to close this issue and mark it as completed. If the bug re-appears, please feel free to open a new issue! |
Prerequisites
Stencil Version
2.17.x
Current Behavior
When executing
stencil test --spec --e2e --json --outputFile=output.json
the outputFile-argument is badly parsed. It will result injest --spec --e2e --json --outputFile=output.json output.json
, wich will result in not executing jest.However executing
stencil test --spec --e2e --json --output-file output.json
will succeed.Cause is in the
parse-flags.ts
file:matchingArg
(on line 4) should only contain--outputFile=
but now contains--outputFile=output.json
Expected Behavior
Expect to execute jest with:
jest --spec --e2e --json --outputFile=output.json
Steps to Reproduce
execute
stencil test --spec --e2e --json --outputFile=output.json
Code Reproduction URL
Additional Information
No response
The text was updated successfully, but these errors were encountered: