-
-
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-resolve: check if the path is a symbolic link before resolving realpath #6906
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. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #6906 +/- ##
==========================================
+ Coverage 66.98% 66.99% +<.01%
==========================================
Files 250 250
Lines 10360 10361 +1
Branches 3 4 +1
==========================================
+ Hits 6940 6941 +1
Misses 3419 3419
Partials 1 1
Continue to review full report at Codecov.
|
@thymikee I can run this build against some large jest test suites if you want and post the results |
Would be lovely @palmerj3! |
Bonus points for running on Windows |
This needs a changelog entry 😀 Excited about this fix, seems really reasonable. @nickpape-msft thoughts? |
@SimenB, changelog updated. |
So I ran a large apps unit test suites against this PR, jest master, and jest 23.4.2 for comparison and here are the results. These were all run on MacOS. I'm not currently setup locally to test this on windows but if that's crucial I'll see what I can do. All test runs were with the same jest configuration and using the --no-cache flag. Details for my local environment:
Test results:
Hope this helps! |
Here's my comparison:
|
@thymikee think we have some spam here |
Not sure how to prevent spam like this, deleted for now. |
@mjesun any thoughts on this one? |
Probably @arcanis is a better one for this one. |
Just my opinion, but I don't think this change is a good idea. Using Something in particular that worries me is that symlinks can be anywhere in the path, there's no reason why only the last path component would be a symlink, and I'm pretty sure this change would break that (what if My suggestion if you really need to add support for this would be to 1/ guard the change so that it only applies on Windows (and ideally only on systems that suffer from this), and 2/ mimic the full realpath behavior by using @asapach You mentioned in #6880 that realpath was using |
@arcanis, realpath-native is being used there, so it's calling the native function: https://github.com/facebook/jest/blob/e9350f6121d4bdb378d53b53a07c6d6fba5618c2/packages/jest-resolve/src/node_modules_paths.js#L14
Yes, sorry, I didn't test it thoroughly enough.
I still think that one call to Here's how I tested it - create the following directory structure
For |
OK, what if we keep using native |
Here's the proposed solution: master...asapach:realpath |
Looks much better imo 😃 I'd recommend a comment inside the |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Fixes #6880: as discussed in the issue, first check if the path is a symbolic link before resolving
realpath
.I've also removed all the consequent
realpath
calls, because the first one should already resolve the canonical physical path.Test plan
Updated the existing tests to make sure nothing breaks.