-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Enable src/node_modules #1081
Enable src/node_modules #1081
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
I also love putting application-wide packages in a
I find it sad that we have to find other, more complex solution, while the existing resolution algorithm is enough :/ |
What is the resolution now that jestjs/jest#2145 is closed? |
This is becoming sort of critical because we want to remove |
As far as I can see, the issue as been closed as wontfix, not resolved :/ I also created an issue for this (jestjs/jest#1995) in which @cpojer answered me by saying that he would not oppose a fix but he does not have time to take care of it himself. |
I’m sure we can all persuade @cpojer. I can literally bug him all day until he agrees to merge a PR as he moved to the London office. But we need somebody willing to figure out the problem and the solution and submit said PR. |
I'll do anything for you Dan but I may ask you for a favor in the future. |
A day of work on a Jest issue of your choice? |
I updated the PR with the Also, I still have no idea how i'm supposed to write an automated test for this, or if there even are tests in create-react-app (?!) |
preprocessorIgnorePatterns: ["<rootDir>/node_modules"], | ||
haste: { | ||
providesModuleNodeModules: [".*"], | ||
}, | ||
}; |
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.
It's sort of unfortunate that this will end up in config after ejecting.
(@cpojer do we have better options?)
No, we only do artisan tests. On a serious note, if Travis passes it means that a basic project runs webpack and jest correctly without crashing, but you can't automatically test a particular feature right now. |
Hey @gaearon @cpojer @modernserf, I've been working on a monorepo build tool that works with yarn and supports app-level modules under https://github.com/knitjs/knit/tree/master/modules/node_modules/%40knit/jest-config-socks |
To give a quick overview:
Let me know if you need anything else. |
@cpojer just got some time to work on this again. I have some changes in jest that work for create-react-app but have a failing test and I don't understand Jest well enough to know why. Can you help me understand? |
How's the progress on this? I'd love to help because this is kind of a blocking issue for me now. |
@rovansteen get the tests passing on this: modernserf/jest@a687e26 |
@modernserf I think it's best to send a PR to start discussion for better visibility. |
Can I make a general inquiry about what's going on here? The best I can tell is that @modernserf took this under his wing but due to the way I guess what I'm asking is, with all the work around this being prefixed with "Don't work on this, it's being taken care of" but looking like we're stuck until someone (??) fixes There's been no activity for 22 days on any of the issues/pr's related to this. I'd love to try and help on the jest/haste-map side but being that it's new functionality required I don't think it's a great candidate for someone unfamiliar with the jest code base or not in-the-loop with their development goals. How can I help? Or should I transition my projects off the |
@Reanmachine the haste map thing will probably not be fixed per se -- I think the idea was that someone should add a testPathIgnorePatterns config option that actually works with |
Closing. I think we want to have good integration with Yarn Workspaces and/or Lerna instead. |
That's unfortunate as the whole point of the src/node_modules structure is to avoid additional config and dependencies by using the native node module resolution. |
I understand, but it's not the approach the ecosystem is embracing. |
[HOLD] not particularly useful without changes in Jest
Partially fixes #607
These are the necessary changes in react-scripts to allow code to live in
src/node_modules
and allow Jest to run tests in that directory.However, Jest cannot find these tests on its own -- all files in any
node_modules
are filtered out even before the file matching patterns are applied. See issue jestjs/jest#2145.Without changes in Jest, there are a few workarounds:
Import the package tests into a file that jest can find
Whitelist the directories you want to test with the
haste.providesModuleNodeModules
optionThis is not the intended use for this option, but its used as a whitelist for the haste module resolution, and therefore Jest can find tests in these directories.
TODO