-
Notifications
You must be signed in to change notification settings - Fork 294
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
use kebab-case #924
use kebab-case #924
Conversation
Pull Request Test Coverage Report for Build 3307452593
💛 - Coveralls |
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.
hi @vhdirk Thanks for submitting this PR 👍
In addition to the files you updated, there are a few other places that require similar treatment, such as:
- package.json
- DebugConfigurationProvider and its tests
- process-listeners and its tests: (there is regex looking for watch flags, not sure if it will be impacted, please check when you are at it, thx)
to be consistent. we should probably also update these test cases
- setup-jest-debug.test.ts
- wizard-helper.test.ts
Hi @connectdotz I've gone over all the files you mentioned and changed every occurrence I could find. I've also looked at the regexes in process-listener. Based on some manual tests I did I am pretty sure jest will not change the messages it emits based on the use of camelCase vs kebab-case flags. |
@vhdirk looks good. There are some issues in the jest-community/jest-editor-support#91, let's finish that before merging this, so we can test these changes as a whole. While the changes are quite mechanical, it is significant, we should do more testing... |
@connectdotz Thanks for reviewing. For what it's worth, I've been using this as my daily driver for at least a week now. No issues to be seen :) |
@vhdirk I tested a bit with the new kebab arguments, and bumped into a problem with react-scripts. It seems react-scripts only recognized This means we might have to put the CI flag (in |
What do you think about this: maybe we just pass a flag (a new setting) to jest-editor-support which then converts all jest arguments accordingly. That way, we don't need to hard-code or change anything on the vscode-jest side (maybe?)... |
I could also make a PR for facebook/create-react-app#12801, but I suppose it would still mean that every single app ever made with it will also be broken? I think adding a flag is pretty much the only way forward, though I don't quite understand how that would mean that we don't have to change anything in vscode-jest. I specifically ran into issues there. |
Yes, all existing react projects will still be broken. The patch will only help future projects.
On the top of my head, other than the DebugConfigurationProvider, all other jest options are packed in JestProcess.startRunner, which just pass these options to Regarding DebugConfigurationProvider, only the older version of the debug config will need to switch by the setting, the new version (v2) already give users' the control of the options so no need to do anything there... |
How do you feel about adding https://www.npmjs.com/package/change-case as a dependency? It would make the code quite a bit cleaner. |
I think it might be a bit overkill, given we only need to consider camel => dash/kebab. |
The same author does offer the library in smaller parts: If we have to support both options, I'm not very keen on littering the code with stuff like |
It seems this is pretty much a single line function, I did a quick a test and it seems to work: it('convert to kebab case', () => {
const s = 'testNamePath'.replace(/(\B)([A-Z])/gm, '-$2').toLowerCase();
expect(s).toEqual('test-name-path');
}); Therefore, I think we are ok not to add a new dependency. Overall, I am thinking we will leave On the I hope it makes sense, let me know what you think. |
Hi @vhdirk, are you still interested in finishing this PR? |
close via #1034. Thanks to everyone who participated. |
This PR fixes #923.
Depends on jest-community/jest-editor-support#91