vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

when open project by symbol link path, Testing file tree and specify test file to run doesn't use real path.

Open zyf0330 opened this issue 4 years ago • 13 comments

Environment

  1. vscode-jest version: 4.2.1
  2. node -v: v14.17.1
  3. npm -v or yarn --version: 3.0.1
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected):
  5. your vscode-jest settings if customized:
    • jest.jestCommandLine? [fill]
    • jest.autoRun? [fill]
    • anything else that you think might be relevant? [fill]
  6. Operating system: [fill] Ubuntu

Prerequisite

  • are you able to run jest test from the command line? [fill]
  • how do you run your tests from the command line? (for example: npm run test or node_modules/.bin/jest) [fill]

Steps to Reproduce

  1. open project within symbol link
  2. run specified test file

Relevant Debug Info

Jest doesn't know symbol link now. https://github.com/facebook/jest/issues/12071 But WebStorm convert symbol link path to real path.

Expected Behavior

  1. run it

Actual Behavior

  1. jest alerts No Tests Found because it doesn't know symbol link.

The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...

zyf0330 avatar Nov 16 '21 05:11 zyf0330

Got the same problem here! Thank you for opening this bug issue! It would be nice to add the problem in the README until the bug is fixed.

Can I create a MR for that observation in the README? Will anyone accept something like that?

evandrojr avatar Nov 22 '21 14:11 evandrojr

hmm... do you have a sample repo to demonstrate the issue? a trivial symlink (same directory) seems to work just fine.

connectdotz avatar Nov 22 '21 21:11 connectdotz

@connectdotz After some tests, I find that only cross-filesystem symbol link has this problem. By the way, I use Ubuntu. This is what the test file tree is like: image But I cannot reproduce second problem, which is test cannot be run. Maybe my real project has some special settings.

zyf0330 avatar Nov 23 '21 02:11 zyf0330

@zyf0330 Are you able to run jest in the terminal? If jest failed in the terminal as well, then the root cause is in jest, and you will have better luck following up there (looks like you already opened an issue there).

if you have a demo project, can you share the link? It will help whoever working on this issue.

connectdotz avatar Nov 23 '21 22:11 connectdotz

Works in terminal. It is related to the extention.

Em ter., 23 de nov. de 2021 19:33, ConnectDotz @.***> escreveu:

Are you able to run jest in the terminal? If jest failed in the terminal as well, then the root cause is in jest, and you will have better luck following up there (looks like you already opened an issue there).

if you have a demo project, can you share the link? It will help whoever working on this issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jest-community/vscode-jest/issues/798#issuecomment-977233026, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHFMWEHFMTKS4A77HNJWCDUNQJDNANCNFSM5IDMZJQA .

evandrojr avatar Nov 23 '21 22:11 evandrojr

@evandrojr, or whoever encountered a similar issue, please create a sample repo so we can evaluate if and how to address this. thanks.

connectdotz avatar Nov 25 '21 17:11 connectdotz

The problem I had is using a symlink to access the repo and then running the tests. The symlink is outside the repo as it points to the repo.

Then "cd" to the symlink and run the tests using the extension. Command line works just fine.

Everything is ext4, no need to use a different FS.

like: % cd company/a/b/c works (no symlink)

% cd a/b/c (does not work using symlink "a" to dir company/a)

Sorry, but the source code is confidential.

@evandrojr https://github.com/evandrojr, or whoever encountered a similar

issue, please create a sample repo so we can evaluate if and how to address this. thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jest-community/vscode-jest/issues/798#issuecomment-979363580, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHFMWD5EKS4IRAYE7OGCEDUNZUCTANCNFSM5IDMZJQA .

evandrojr avatar Nov 25 '21 22:11 evandrojr

I assume this is from the symlink bug? I can run my tests but the test explorer output is really annoying. I don't want my test results to be 20 levels deep...

image

$ pwd
/home/jcormier/projects/criticallink_svn/production_tools_gitsvn/sw/PartsMonitor
$ ls -la /home/jcormier/projects
lrwxrwxrwx 1 jcormier engineer 40 Mar 16  2018 /home/jcormier/projects -> /net/wanda/export/home/jcormier/projects

jcormier avatar May 20 '22 20:05 jcormier

Opening project dir without going through symlink does fix it...

image

$ pwd
/net/wanda/export/home/jcormier/projects/criticallink_svn/production_tools_gitsvn/sw/PartsMonitor

jcormier avatar May 20 '22 20:05 jcormier

I have the same issue on windows. My corporate environment require to use a windows junction. Every project is accessible under this junction.

this plugin doesn't supports this symlink: tests are show with a "../../../C:/path/to/project/without/the/junction". The decoration of the editors doesn't work either (I suppose there is a mismatch between the file in the editor and the file path assumed by this plugin).

If I open the project directly without using the junction, it works correctly.

j3rem1e avatar Jun 24 '22 11:06 j3rem1e