jest
jest copied to clipboard
Support for --preserve-symlinks
Summary
This is my attempt to fix https://github.com/facebook/jest/issues/5356 - I have been making very slow progress over the past months on this so I thought I would just open this PR to increase visibility and maybe someone else is inclined to help finish this up quicker.
For motivation see the discussion at #5356
Whit is still missing:
- Making sure the flag is piped through correctly everywhere, it is a bit difficult to keep track of all the places, especially given the time frame I have worked on this but as far as I remember only packages/jest-runtime/src/script_transformer.js is missing and I think making sure to whoever is calling the jest-resolve package to ensure the defaultResolver gets the flag set correctly
- changelog entries
- tests
Test plan
Still need to add tests but the test plan would be the follwoing:
- Create a test file, e.g. sum.test.js
- Create a symlink of that file in a different directory (e.g.
ln -s ../sum.test.js ./sum.test.js) - Make sure you are in that directory that contains the symlink and run `jest --preserve-symlinks sum.test.js
- See that the test is actually running
Would be cool to add e2e test for that :)
Just as an update, internally we managed to work around the missing symlinks by using: https://jestjs.io/docs/en/cli#runtestsbypath which works well enough with bazel as an underlying build/test system.
Edit: We actually started running into issues, it does bypass the issue of jest not finding the tests but it still seems to be trying to dereference files in various places causing some unexpected behaviour.
Any update on this?
Any plans on getting this merged? Really need it
Hi @SimenB could you please merge this. This is so annoying and makes using symlinks alongside jest very difficult.
I'm very sorry about the slow response here - this touches a part of the code base I'm not really familiar with, and has huge potential perf consequences if done wrong.
That said, I'm happy to merge this when e2e tests are added.
This now has a horrible conflict, and I apologize for that as well. It's mostly due to the code now being written in TypeScript. Could you rebase/merge master and add a test?
FWIW, I've been using this patch against jest 24.7.1, and I haven't noticed any issues. (I don't use watchman.)
This PR is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.
This PR was closed because it has been stalled for 30 days with no activity. Please open a new PR if the issue is still relevant, linking to this one.
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. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.