-
-
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
Jest resolver does not follow symbolic links #1477
Comments
This is a deliberate design decision because symlinks always cause trouble. I recommend you to use the |
Does My issue is with test files not modules, when I run
Adding the folder Thanks. |
I recommend trying to use jest@test which is gonna be the next release of Jest. |
I'll try it, thank you so much. |
Do you mean |
I understand that you don't like symlinks, however I don't follow why you would block using them within the tool. Anyone that doesn't want to use symlinks doesn't have to, they just don't create them, but for you to disallow symlinks within the test finder makes our setup very hard to work with, especially since all the other tools we use are completely happy with symlinks. Our setup looks like
All the code shared between the 2 projects is in the real shared folder and both projects use a symlink to place that folder into both projects. ProjectA is the main website, ProjectB is the admin website, so the shared folder is used extensively by both projects. What I've shifted to is:
Which will work, but is less obvious than the original layout. All because one tool (jest) has decided that symlinks "always cause trouble", something I would debate is false. So while it might be by design, does that design actually make sense in light of the rest of the toolchain which works just fine with symlinks? |
I think everything is working just fine in Jest, except for locating test files, which imho is a reasonable trade-of for what we are doing inside of jest's haste map. |
So, even though all the other tools work with symlinks, since you don't like symlinks, its perfectly acceptable for jest to explicitly ignore symlinks? Is that what you are saying? |
Feel free to send us a pull request that fixes Jest to fit your use case. If it doesn't make Jest harder to maintain and works within our constraints, I'm happy to accept it. Personally, the only reason I get to work on Jest at Facebook is because I'm solving Facebook's problems related to JavaScript testing. This is not a problem for us so I'm not able to justify working on it myself. |
@cpojer Do you think it would be easier to implement symlink support for |
no, I think it would make sense to support them overall. I think if you change the node crawler to support them behind a flag (that would disable watchman as well), I wouldn't stop you from adding it to the codebase, granted it is well written and tested etc. |
Created a PR to solve this #4387, I'd appreciate some feedback over there. |
Is there any interest in this still? Having the ability to configure Jest to follow symlinks would make life in the monorepo world a lot easier. Currently each of our packages needs its own copy of a global |
After lots of experimenting and digging through docs, it appears one can use the |
@davesidious thanks for sharing your solution. Works on our project too. |
@difelice I'm glad I could help! |
Yeah, I'm working with a monorepo too, and lack of symlink support is a real pain. |
Any update here? |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have the following tree:
When running
npm test
all tests inside the symbolic link shared are not executed by the client.Thank you.
The text was updated successfully, but these errors were encountered: