-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Support dashed args #7497
Support dashed args #7497
Conversation
@SimenB I imagine docs will need to be updated to reflect support for dashed args? |
Can we either
Yeah, a note saying both ways of defining the options are supported would be nice 🙂 Mind updating the changelog as well? |
|
Merging on our side is fine, then 🙂 I assume the values have been normalized, so it's not a lossy transformation |
The problem i see with this - is that it will convert dashed to camel. Then, it will report as if you attempted the camelcased arg. |
@SimenB ok, updated docs & changelog |
Is the change here that you could pass args as dashed instead of camel case? Is there a reason we shouldn't enforce the current camelCase style? |
Standard cli is dashes, not camel. Jest is the only cli I know of that does camelCase |
@SimenB @rickhanlonii I noticed this is failing the node@6 ci build. Should it be passing, in order to allow merge? Btw, (unrelated to above): latest release $ mkdir foo && cd foo && yarn init --yes
$ yarn add [email protected]
$ ls node_modules/jest-cli/
> bin/ node_modules/ LICENSE README.md package.json
$ cat node_modules/jest-cli/package.json | jq -r .main
> build/jest.js |
Node 6 has to pass, yes 🙂 However, the failure looked transient, so I restarted the whole build. 🤞 |
@SimenB found out why it was failing: |
Codecov Report
@@ Coverage Diff @@
## master #7497 +/- ##
==========================================
- Coverage 67.46% 67.45% -0.01%
==========================================
Files 247 247
Lines 9516 9514 -2
Branches 5 6 +1
==========================================
- Hits 6420 6418 -2
Misses 3094 3094
Partials 2 2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a couple comments on documentation
CHANGELOG.md
Outdated
@@ -38,6 +38,7 @@ | |||
|
|||
### Fixes | |||
|
|||
- `[jest-cli]` Support dashed args ([#7497](https://github.com/facebook/jest/pull/7497)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this below the breaking changes, preferably at the bottom of this section?
docs/CLI.md
Outdated
@@ -81,6 +81,21 @@ you can use: | |||
npm test -- -u -t="ColorPicker" | |||
``` | |||
|
|||
## Camelcase & dashed args support | |||
|
|||
Jest supports both camelcase and dashed arg formats. Which means the following examples will have equal result: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jest supports both camelcase and dashed arg formats. Which means the following examples will have equal result: | |
Jest supports both camelcase and dashed arg formats. The following examples will have equal result: |
docs/CLI.md
Outdated
jest --collectCoverage | ||
``` | ||
|
||
They can also be mixed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can also be mixed: | |
Arguments can also be mixed: |
@rickhanlonii ok all set, I think. |
CI still failing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to verify, the object passed around as globalObject
after jest-config
has done its thing has just the camelCase keys, right?
arg => !allowedOptions.has(arg), | ||
); | ||
const unrecognizedOptions = Object.keys(argv).filter(arg => { | ||
const camelCased = arg.replace(/-([^-])/g, (a, b) => b.toUpperCase()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add camelize
dep?
222166b
to
3f45e11
Compare
Hmm so good question - because, this is already an issue in master + this pr. I'll include that fix here:
aka...remove the dashed entries of |
@SimenB k, using camelcase, filtering returned argv result & added test for it |
0d1a477
to
90ce0fd
Compare
@SimenB nvm, fixed |
90ce0fd
to
096d750
Compare
096d750
to
bad4999
Compare
@SimenB k, ci passing now |
Thanks @hulkish and congrats on your first Jest PR! |
* master: (24 commits) Add `jest.isolateModules` for scoped module initialization (jestjs#6701) Migrate to Babel 7 (jestjs#7016) docs: changed "Great Scott!" link (jestjs#7524) Use reduce instead of filter+map in dependency_resolver (jestjs#7522) Update Configuration.md (jestjs#7455) Support dashed args (jestjs#7497) Allow % based configuration of max workers (jestjs#7494) chore: Standardize filenames: jest-runner pkg (jestjs#7464) allow `bail` setting to control when to bail out of a failing test run (jestjs#7335) Add issue template labels (jestjs#7470) chore: standardize filenames in e2e/babel-plugin-jest-hoist (jestjs#7467) Add node worker-thread support to jest-worker (jestjs#7408) Add `testPathIgnorePatterns` to CLI documentation (jestjs#7440) pretty-format: Omit non-enumerable symbol properties (jestjs#7448) Add Jest Architecture overview to docs. (jestjs#7449) chore: run appveyor tests on node 10 chore: fix failures e2e test for node 8 (jestjs#7446) chore: update docusaurus to v1.6.0 (jestjs#7445) Enhancement/expect-to-be-close-to-with-infinity (jestjs#7444) Update CHANGELOG formatting (jestjs#7429) ...
* added dashed arg support to fix jestjs#7424 * update docs & changelog * fix dashed arg support tests * move changelog item to correct location, small edit to docs * use camelcase, filter dashed args on returns config
* added dashed arg support to fix jestjs#7424 * update docs & changelog * fix dashed arg support tests * move changelog item to correct location, small edit to docs * use camelcase, filter dashed args on returns config
* added dashed arg support to fix jestjs#7424 * update docs & changelog * fix dashed arg support tests * move changelog item to correct location, small edit to docs * use camelcase, filter dashed args on returns config
* added dashed arg support to fix jestjs#7424 * update docs & changelog * fix dashed arg support tests * move changelog item to correct location, small edit to docs * use camelcase, filter dashed args on returns config
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Fixes #7424.
Test plan
Added tests & ran:
yarn build && yarn jest