jest icon indicating copy to clipboard operation
jest copied to clipboard

Support for --preserve-symlinks

Open Globegitter opened this issue 7 years ago • 8 comments
trafficstars

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:

  1. Create a test file, e.g. sum.test.js
  2. Create a symlink of that file in a different directory (e.g. ln -s ../sum.test.js ./sum.test.js)
  3. Make sure you are in that directory that contains the symlink and run `jest --preserve-symlinks sum.test.js
  4. See that the test is actually running

Globegitter avatar Nov 14 '18 08:11 Globegitter

Would be cool to add e2e test for that :)

thymikee avatar Nov 14 '18 09:11 thymikee

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.

Globegitter avatar Feb 25 '19 11:02 Globegitter

Any update on this?

marmos91 avatar Aug 08 '19 19:08 marmos91

Any plans on getting this merged? Really need it

zackify avatar Oct 17 '19 20:10 zackify

Hi @SimenB could you please merge this. This is so annoying and makes using symlinks alongside jest very difficult.

HosseinAgha avatar Nov 05 '19 08:11 HosseinAgha

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?

SimenB avatar Nov 09 '19 17:11 SimenB

FWIW, I've been using this patch against jest 24.7.1, and I haven't noticed any issues. (I don't use watchman.)

pauldraper avatar Mar 24 '20 03:03 pauldraper

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.

github-actions[bot] avatar Sep 08 '22 18:09 github-actions[bot]

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.

github-actions[bot] avatar Oct 08 '22 19:10 github-actions[bot]

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.

github-actions[bot] avatar Nov 08 '22 00:11 github-actions[bot]