facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.71k stars 26.85k forks source link

Add Jest configuration for snapshotresolver #6532

Open akuji1993 opened 5 years ago

akuji1993 commented 5 years ago

As I understand, right now CRA only supports a handful of Jest configuration overrides, either by adding them to package.json or adding a jest.config.js to your project.

First question would be, why are you not allowing to just add a jest.config.js and read all of the configuration variables that Jest provides usually, why add just a few of them?

And the more important suggestion, can you add snapshotresolver to this list of allowed customizations? https://jestjs.io/docs/en/configuration#snapshotresolver-string

It has been added with Jest 24 and would really help clean up the codebase a bit, since I don't think it's necessary to have generated code right next to my .tsx, .scss and .test.ts files.. If not, could you at least explain, how the decision was made to not just check for a jest.config.js and then give it to the test runner, so the dev can decide what they want to override or not.

avaleriani commented 5 years ago

This functionality would be really useful.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

akuji1993 commented 5 years ago

I'd really like to have a reaction to this.

jareware commented 5 years ago

Was about to open this issue, but was happy to find it here already! Similar to #3116, this could be a pretty simple fix.

akuji1993 commented 5 years ago

I just checked the source code and this shouldn't be hard to implement. I will try to put together a pull request for this, should be a no brainer.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

jareware commented 5 years ago

Bumping to avoid staleness; still very much looking forward to a solution!

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

jareware commented 5 years ago

Still interested!

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

akuji1993 commented 5 years ago

Hopefully I did everything right, this is my first PR into any large repository.

jamesopti commented 4 years ago

Is there any opposition from the CRA team to allowing all options specified in a jest.config.js file to be used and override the defaults? I don't see the harm.

orlandovallejos commented 4 years ago

any news about this?

akuji1993 commented 4 years ago

Nobody seems to look at the Merge Request.

philwindsor commented 4 years ago

Is there any work around for getting this to work with CRA (without the PR)?

efranca commented 4 years ago

didnt it go ahead? It'd be very very useful!!!

ksk385 commented 3 years ago

Still interested in this - any update on when it will be added?

jslmariano commented 3 years ago

It seems like the PR has been tagged as an enhancement :( It'll be so soon

DjellalAbdou commented 2 years ago

I was going to do the same PR until I stumbled on this, it really should be merged, a nice feature to add, and a well-needed one to make folders structure neater.

sullrich84 commented 2 years ago

Any maintainer feedback on this on?

billwatson017 commented 1 year ago

any support in the future for this feature request?