File naming conventions in Jest can be improved. A good example is the integration_tests folder. We have:
auto-clear-mocksclear_cachetestNamePatterntimer-resetMocksstack_trace_no_captureStackTraceregex-(char-in-pathI understand that some of the camel cased ones reference actual method names, like captureStackTrace, but I think we could do it better. This is absolutely not top-priority, but I just wanted to add a task to it because it feels there's room for improvement.
I want to use camelCase for functions, dashes for folders and Capitalized for classes. I'll send a tshirt to the person that makes this happen.
cc @aaronabramov
+1 to @cpojer's suggestion. I think it matches the "standard" at the industry.
For the reference: https://github.com/facebook/jest/issues/3771
I'll take a look on this
@mjesun Can I take up this issue
@ajomadlabs maybe you can sync with @slootzky? There are a lot of files, so you can maybe split; but I'd rather double-check before getting the work done twice 🙂
@ajomadlabs @mjesun sorry for not being responsive , well I actually did all the necessary changes (I believe) but then had to work on something else and didn't have the chance to start testing all.
I really hope to do it tomorrow and then I'll send the PR.
@ajomadlabs, if I see I'm still not getting to this tomorrow, I will update here.
Hey @ajomadlabs @mjesun ,
Sorry but I just can't get to completing this :(
Guess I will just need to find some time and get another issue fixed.
@slootzky so can I take up this
Thanks @ajomadlabs! Let me know if you need any help with something 🙂
Is this issue sufficiently spec'ed out? I'm unclear.
The above comment suggest to use camelCase and CapitalizeCase, but the linked issues suggest everything be underscore case...
So is the final recommendation:
kabab-caseCapitalizeCasecamelCaseunderscore_case__ (eg. __tests__) -> Stay the same.This might be something to document in the contributing guidelines under Code Conventions.
Yes; how should we name things has always been a complex topic in Jest. I'm sorry if we created more confusion linking the other task, but I think it was necessary to keep proper track of everything 🙂
I think @cpojer's comment regarding PascalCase and camelCase was specifically referred to syntax rather than to files; but let's double-check. Personally, I would name all folders and files with kebab-case (except special folders, like __tests__ or __mocks__), so we do not make a distinction between files that export a single thing, or multiple ones.
I 100% agree with your suggestion of adding this to the code conventions; since we're the first ones (at Facebook) to consistently break them. Let's fully clarify here before proceeding.
Hey everyone! I’d love to stop bikeshedding about this and just revert to standard Facebook practice:
Let me know if anyone has any other questions for this one but I don’t think it’s ambiguous :)
I’ll take a stab at this tomorrow. What does “done” look like? Tests passing as before? Anything else?
@jamischarles yarn test should pass, which includes Flow and ESLint checks.
Also, maybe let's do it incrementally package-by-package (or a few if they're small), as this affects whole codebase and will basically make every existing PR affected.
We have an eslint rule for filename, is it possible to maintain that with different styles of names?
https://github.com/facebook/jest/blob/19376c1e1e8a77717fbb7a216df92087eddbd277/.eslintrc.js#L171
@thymikee Makes sense, thanks.
@SimenB I suggest that during the transition we change this from error (2) to warning (1), and after we're done we change it back. How does that sound?
SGTM
Here's the first big PR for this. I did this one manually, just to get a feel for it.
Here's a check list to keep track of what still needs to be converted:
Integration_tests/ folder-names #5298 Integration_tests/ file-names packages/ (we'll expand this list)Only one done
Anything left to do in this issue?
@atiqueansari1987 yes there is quite a bit of work left. You could either start with the task to rename file names under integration-tests or you can choose another folder. See the checklist above. Quite a bit of work left.
I suggest renaming folders as a separate task / PR than renaming files. Just renaming the folders was enough work that it warranted its own PR. Up to you though.
Thanks for the info. I will try to submit a PR this weekend.
I would love to help with that. If there is still work left to do, can someone point me to a place where work should be done?
@binygal I'd start by picking one folder, and then renaming all the subfolders that don't follow the naming convention here: https://github.com/facebook/jest/issues/4969#issuecomment-354961645
I would also love to help with this. Is https://github.com/facebook/jest/issues/4969#issuecomment-357408475 still relevant?
@neosiae yup
I'm working on this one. How many files should I change in one PR so it makes sense and we won't fall into endless conflicts and rebases?
Probably on a per-folder / per-package basis is good to go :) (sorry for the late reply!)
That's what I did in the referenced PR. I will try to keep working on standartize the file names.
Sounds awesome!
Hello!
I would love to help with this issue. Is it possible to provide a checklist to keep track whats already done?
@silltho I think you can start with standartize the sub folders under jest-cli.
Hello!
I'd love to help too!
I went over sub folders under jest-config (last referenced in this thread) and it seems there's still work to be done. Can I take the next in line?
Yeah, go for it!
Hey 👋 I'd like to help also - took a quick look and seems like jest/packages/jest-haste-map needs some cleanup, can I take it?
Absolutely, do it :)
I quickly went over the content of packages to get a feel whats left to be done, marked stuff that seems to be complaint with facebook standards already below.
As the renames are quite easy to do, maybe we could use hacktoberfest label to get more people to help with work?
Integration_tests/ folder-names #5298Integration_tests/ file-namespackages/babel-jestbabel-plugin-jest-hoistbabel-preset-jestdiff-sequenceseslint-config-fb-strictexpect (@andrew-pyle)jestjest-changed-filesjest-circus (@andrew-pyle)jest-clijest-configjest-diffjest-docblockjest-eachjest-environment-jsdomjest-environment-nodejest-get-typejest-haste-mapjest-jasmine2 (@Anenth)jest-leak-detectorjest-matcher-utilsjest-message-utiljest-mockjest-phabricatorjest-regex-utiljest-repljest-resolve (@Anenth)jest-resolve-dependenciesjest-runner (@betalantz)jest-runtime (@betalantz)jest-serializerjest-snapshot (@betalantz)jest-util (@Anenth)jest-validate (@Anenth)jest-watcher (@andrearosr)jest-worker (@monkey3310 )pretty-format (@monkey3310 )Added! thanks for this @monkey3310.
To anyone interested in tackling any of the remaining packages: let us know in a comment under this thread and we'll assign you on the list provided above :)
@thymikee I would happy to knock off the remaining
@thymikee First-time contributor here. I’ll take a few packages too. Just assign them.
Lovely! @Anenth @andrew-pyle I've just assigned 2 packages to each of you. Let's start small and then we'll followup with further work :)
@thymikee Another first-time contributor here for Hacktoberfest. If there are more packages to do, I'd take a few.
@thymikee https://github.com/facebook/jest/pull/7290, Let me know if this is right direction,
I have doubts
isError.js. its imported as import checkIsError from './is-error.js should we change the variable name to isError? setup_jest_globals I havnt changed this, as I think this is categorized under Other files@betalantz done, thanks!
@Anenth
isError 👍 setupJestGlobals as it exports a single fn@thymikee am picking up jest-util
I'm picking up jest-watcher
I will pick up jest-worker and pretty-format
@betalantz are you still interested in converting files assigned to you?

@andrearosr need any help with jest-watcher? :)
Yes, I'm available to work on this. I'll follow the assignments above, unless they've been assigned elsewhere.
Hello! 🖐 First-time-contributor here. If there are any packages or folders remaining I can help take on a few.
@GGonryun feel free to take over jest-watcher :)
And maybe root filenames in other PR?
Hey there! I hadn't seen the other messages to this thread, I did jest-watcher in #7315 so I think the packages folder may be done
picked up jest-snapshot. getting a PR ready. jest-runner needs to be checked off, as well. are there actually any root file/folders left to be renamed?
Hello, I also want to make my first contribution can I work on this issue?
Hi, first-timer here! If there's room for another I'd love the opportunity to work on this issue. Please let me know.
Thank you!
Most helpful comment
I want to use camelCase for functions, dashes for folders and Capitalized for classes. I'll send a tshirt to the person that makes this happen.